Skip to content
Prev 174724 / 398506 Next

Legend containing maths symbol and values of variables

So what about

threshold <- 0.5
plot(NA, xlab="", ylab="", main="", axes=F, xlim=c(0,1),
     ylim=c(0,1), xaxs="i", yaxs="i")
legend1 <- substitute("Up (" * phantom() >= threshold * ")",
     list(threshold=threshold))
legend(x=0, y=1, fill=c("orange", "white", "green", "gray90"),
   cex=0.8, pt.cex=1.8, x.intersp=0.6, bg = "white", bty = "n",
   legend =
     do.call("expression", list(legend1, "Normal", "Down", "NA")))
Daren Tan wrote: