I am trying to label a plot with the following label:
"Some Assay EC50 (uM)" where the "u" is a micro symbol.
I currently have:
assay <- "Some Assay"
plot(0,xlab=expression(paste(assay," AC50 (",mu,"M)",sep="")))
But that gives: "assay EC50 (uM)" rather than the desired "Some Assay EC50 (uM)".
Suggestions? Thanks.
I also tried:
paste(assay,expression(paste(" AC50 (",mu,"M)",sep="")),sep="")
You want a combination of bquote()
and a bit of plotmath fu:
assay <- "Some Assay"
xlab <- bquote(.(assay) ~ AC50 ~ (mu*M))
plot(0, xlab = xlab)
The ~
is a spacing operator and *
means juxtapose the contents to the left and right of the operator. In bquote()
, anything wrapped in .( )
will be looked up and replaced with the value of the named object; so .(assay)
will be replaced in the expression with Some Assay
.