I have been trying to figure out how to get superscript/subscript in the main title for a plot. I have tried various approaches and suggestions but none of them work. I am trying to get the following as the main title of my plot: Emission of CO2 with time (but note that 2 is subscript.) I have tried plot(main="Emission of C"expression(O[2]) "with time") and I get error message. I have also tried plot(main="Emission of C"quote(O[2]) "with time") I have also tried plot(main"") mtext("Emission of C"expression(O[2]) "with time") I keep getting errors. I have searched the archives but none of the threads seem to touch upon this. I would appreciate any suggestion. Regards, Tariq [[alternative HTML version deleted]]
Try this: plot(1:10, main = expression(Emission~of~CO[2]~with~time)) On Wed, Jun 4, 2008 at 5:31 PM, Tariq Perwez <tariq.perwez@gmail.com> wrote:> I have been trying to figure out how to get superscript/subscript in the > main title for a plot. I have tried various approaches and suggestions but > none of them work. I am trying to get the following as the main title of my > plot: > > Emission of CO2 with time > > (but note that 2 is subscript.) > > I have tried > > plot(main="Emission of C"expression(O[2]) "with time") > > and I get error message. I have also tried > > plot(main="Emission of C"quote(O[2]) "with time") > > I have also tried > > plot(main"") > mtext("Emission of C"expression(O[2]) "with time") > > I keep getting errors. I have searched the archives but none of the threads > seem to touch upon this. I would appreciate any suggestion. Regards, > > Tariq > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > 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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
Hi Tariq, try: plot(x,y,main=expression("Emission of CO"[2]*" with time")) Cheers, Christoph Wednesday, June 4, 2008, 10:31:08 PM, you wrote:> I have been trying to figure out how to get superscript/subscript in the > main title for a plot. I have tried various approaches and suggestions but > none of them work. I am trying to get the following as the main title of my > plot:> Emission of CO2 with time> (but note that 2 is subscript.)> I have tried> plot(main="Emission of C"expression(O[2]) "with time")> and I get error message. I have also tried> plot(main="Emission of C"quote(O[2]) "with time")> I have also tried> plot(main"") > mtext("Emission of C"expression(O[2]) "with time")> I keep getting errors. I have searched the archives but none of the threads > seem to touch upon this. I would appreciate any suggestion. Regards,> Tariq> [[alternative HTML version deleted]]> ______________________________________________ > R-help at r-project.org mailing list > 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.*************************************************************** Dr. Christoph Meyer Institute of Experimental Ecology University of Ulm Albert-Einstein-Allee 11 D-89069 Ulm Germany Phone: ++49-(0)731-502-2675 Fax: ++49-(0)731-502-2683 Mobile: ++49-(0)1577-156-7049 E-mail: christoph.meyer at uni-ulm.de http://www.uni-ulm.de/nawi/nawi-bio3.html