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)
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:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With