I have some variable and want to use in legend with colors, simply its work like:
## fake plot
plot(0)
## color legend
LCol <- c("PValue > 0.05"="dimgray","PValue <0.05"="red", "PValue <0.05&logFC>|1|"="darkturquoise", "adj.P.Val <0.1&logFC>|1|"="navy")
## legend
legend('topright', legend=rev(names(LCol)), pch = 19, col=rev(LCol),cex=.6)
but i want to replace variable value in legend text using bquote function and i tried:
## Parameters
padj_Cutoff <- 0.1
pval_Cutoff <- 0.05
logFC_Cutoff <- 1
mylegend <- c(bquote(PValue > .(pval_Cutoff)),
bquote(PValue < .(pval_Cutoff)),
bquote(c(PValue,lfc) < .(c(pval_Cutoff,logFC_Cutoff))),
bquote(c(adj.P.Val,lfc) < .(c(padj_Cutoff,logFC_Cutoff))))
plot(0)
leg.col <- c("dimgray", "red","darkturquoise","navy")
legend('topright', legend=rev(mylegend), pch = 19,col = rev(leg.col),cex=.6)
but the legend is not similar what i was expected (please see expected legend in attached figure).