Durant, James T. (ATSDR/DTEM/PRMSB)
2011-Sep-30 15:31 UTC
[R] isotope superscripts ggplot2
Happy Friday fellow R users. I need some help - I am trying to make a graph using ggplot 2 of some lead isotope ratios. Normally, the isotope mass number appears as a superscript before the chemical symbol. However, I cannot figure out how to do this ggplot2's axis labels. The closest I have come is using "." In front of the numbers I am superscripting e.g: ggplot(.... +xlab(expression(.^207*"Pb/"*.^206*"Pb"))+ylab(expression(.^208*"Pb/"*.^206*"Pb") I have searched for this and have not had any luck so far... any suggestions? VR Jim James T. Durant, MSPH, CIH Emergency Response Coordinator DIvision of Toxicology and Environmental Medicine US Agency for Toxic Substances and Disease Registy Mailing Address: 4770 Buford Highway, MS F-62 Atlanta, Georgia 30341 Telephone: 770-488-0668 (office) 770-378-1695 (cell) [[alternative HTML version deleted]]
On Fri, Sep 30, 2011 at 4:31 PM, Durant, James T. (ATSDR/DTEM/PRMSB) <hzd3 at cdc.gov> wrote:> Happy Friday fellow R users. > > I need some help - I am trying to make a graph using ggplot 2 of some lead isotope ratios. Normally, the isotope mass number appears as a ?superscript before the chemical symbol. However, I cannot figure out how to do this ggplot2's axis labels. The closest I have come is using "." In front of the numbers I am superscripting e.g: > > > ggplot(.... +xlab(expression(.^207*"Pb/"*.^206*"Pb"))+ylab(expression(.^208*"Pb/"*.^206*"Pb")Stick an empty expression in place of the '.' something like: expression({}^208*"Pb/"*{}^206*"Pb") Barry
On 9/30/2011 8:31 AM, Durant, James T. (ATSDR/DTEM/PRMSB) wrote:> Happy Friday fellow R users. > > I need some help - I am trying to make a graph using ggplot 2 of some lead isotope ratios. Normally, the isotope mass number appears as a superscript before the chemical symbol. However, I cannot figure out how to do this ggplot2's axis labels. The closest I have come is using "." In front of the numbers I am superscripting e.g: > > > ggplot(.... +xlab(expression(.^207*"Pb/"*.^206*"Pb"))+ylab(expression(.^208*"Pb/"*.^206*"Pb") > > I have searched for this and have not had any luck so far... any suggestions?You can replace the . with phantom("") This will give the ^ something to be an exponent of (namely, a non-printed blank).> VR > > Jim > > James T. Durant, MSPH, CIH > Emergency Response Coordinator > DIvision of Toxicology and Environmental Medicine > US Agency for Toxic Substances and Disease Registy > > Mailing Address: > > 4770 Buford Highway, MS F-62 > Atlanta, Georgia 30341 > > Telephone: > 770-488-0668 (office) > 770-378-1695 (cell) > > > [[alternative HTML version deleted]] >-- Brian S. Diggs, PhD Senior Research Associate, Department of Surgery Oregon Health & Science University