Reputation: 7517
I was wondering what's wrong with mtext()
that I can't get the number G
correctly show above my plot?
Here is my R code:
G <- .3333 ## but G can be anything as it comes from a function
curve(dnorm(x),-3,3)
mtext(expression(paste("Medium: ",bold('CT'[12])," = ", round(G,2))),line=3)
Upvotes: 3
Views: 1075
Reputation: 37889
You can use bquote
and .()
(this is used to include variables in an expression) for this:
G <- 0.3333
curve(dnorm(x),-3,3)
mtext(bquote(paste("Medium: ",bold('CT'[12])," = ", .(round(G,3)))),line=3)
This gives:
Upvotes: 3