BTW, for your amusement, ylab = ~ frac(additive ~ HCO[3]^"-", true ~ HCO[3]^"-" ))
also should work. The reason is (from ?plotmath): "In most cases other language objects (names and calls, including formulas) are coerced to expressions and so can also be used." Cheers, Bert On Fri, Feb 2, 2024 at 8:33 AM Bert Gunter <bgunter.4...@gmail.com> wrote: > > ... or if I understand correctly, simply > > expression(frac(additive ~ HCO[3]^"-", > true ~ HCO[3]^"-" ))) > > Cheers, > Bert > > On Fri, Feb 2, 2024 at 3:06 AM Rui Barradas <ruipbarra...@sapo.pt> wrote: >> >> Às 10:01 de 02/02/2024, Troels Ring escreveu: >> > Hi friends - I'm plotting a ratio of bicarbonates i ggplot2 and >> > >> > ylab(expression(paste(frac("additive BIC","true BIC")))) worked OK - but >> > now I have been asked to put the chemistry instead - so I wrote >> > >> > ylab(expression(paste(frac("additive",HCO[3]^"-","true",HCO[3]^"-")))) >> > - and frac saw that as additive = numerator and HCO3- = denominator and >> > the rest was ignored- >> > >> > So how do I make frac ignore the first "," and print the fraction as I >> > want? >> > >> > >> > All best wishes >> > Troels >> > >> > ______________________________________________ >> > 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. >> Hello, >> >> This seems to work. Instead of separating the two numerator strings with >> a comma, separate them with a tilde. The same goes for the denominator. >> And there is no need for double quotes around "additive" and "true". >> >> >> library(ggplot2) >> >> g <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + >> geom_point() >> >> g + ylab(expression(paste(frac( >> additive~HCO[3]^"-", >> true~HCO[3]^"-" >> )))) >> >> >> >> Hope this helps, >> >> Rui Barradas >> >> >> -- >> Este e-mail foi analisado pelo software antivírus AVG para verificar a >> presença de vírus. >> www.avg.com >> >> ______________________________________________ >> 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. ______________________________________________ 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.