What I'm missing here? Not getting proper legend label.
p <- ggplot(mtcars, aes(factor(cyl), mpg))+ geom_boxplot(aes(fill = cyl))
p <- p + labs(fill=expression(paste("Temperature\n (", degree ~ F, " )")))
p

I do not see any need to use plotmath-paste:
p <- ggplot(mtcars, aes(factor(cyl), mpg))+ geom_boxplot(aes(fill = cyl))
p <- p + labs(fill=expression(atop("Temperature", ( degree~F))))
p
Plus the help(plotmath) page makes clear that "\n" does not play well with expressions.
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