0

I want to combine text and math symbols in "main" title of my histogram. I've tried using both bquote() and expression() but doesn't seem to work. Below is what I'm trying to do. I want both R^2 and sigma to appear as symbols in my main title if possible.

hist(R2_sig_3, col="lightskyblue", border="royalblue", xlab=expression(R^2),
     main=bquote(~R^2 "values \nfor sigma=10"))

Please advise!

1 Answers1

3

You were nearly there. Does this work?

This includes plotmath for the Greek rendition of sigma and the new line:

hist(iris$Sepal.Length,
     col="lightskyblue",
     border="royalblue",
     xlab = expression(R^2),
     main = expression(~R^2~atop(values~"for",~sigma~"="~10)))

Created on 2021-06-26 by the reprex package (v2.0.0)

Peter
  • 11,500
  • 5
  • 21
  • 31