Dear friends - here is an example of something that I find annoying

library(ggplot2)
DDF <- data.frame(x=x<-seq(1,10),y=x^2)
G <- ggplot(data=DDF,aes(x=x,y=y)) + geom_point()
GG<-G+ylab(expression(paste("Total ",CO[2]," halved")))
GG
GG+annotate("text",x=5,y=50,label=expression(paste("Total ",CO[2]," halved")))

On my system, R version 3.3.2 (2016-10-31) Windows - the third line produces the wanted formatting of CO2 with "2" lowered - while the last line produces an error "invalid 'type' (expression) of argument" - with exactly the same string - how comes?

Beautiful ggplot is not exactly low in documentation but finding the right stuff is not always easy (for me:-))

Best wishes
Troels Ring, MD
Aalborg, Denmark

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to