[R] Superscripts in axis label

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Wed Aug 12 17:41:12 CEST 2009


Hi Sarah,
expression works well, but you have to use it as function.

plot(1,ylab=expression("Soil moisture content 
"~~bgroup("(",m^3*m^{-3},")")))

see
?plotmath
for further examples

hth.

Buckmaster, Sarah schrieb:
> Hi All,
>
> I am trying to lable the y-axis on my scatterplot with the following:
> "Soil moisture content (m3m-3)"
>
> I am using the following coding for plotting the graph:
> plot(soilmoisture~gradientlevel, xlab="Levels of droughting gradient", ylab="Soil moisture content (m3m-3)", bty="l", font.main="2", pch=16, las=1, cex.lab="1.13")
>
> I have tried to incorporate 'expression' into this coding for the ylab as follows (with also a few variations):
> plot(soilmoisture~gradientlevel, xlab="Levels of droughting gradient", ylab=expression"Soil moisture content (m^3m^-3)", bty="l", font.main="2", pch=16, las=1, cex.lab="1.13")
>
> ...but this isn't working and the second m never seems to come up wth superscript 3 after it. I'm guessing I have tried to incorporate 'expression' too simply!
>
> Would someone please advise me as to the coding for this?
>
> Many thanks
>
> Sarah
>
> 	[[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.
>   

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790



-- 
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf
Körperschaft des öffentlichen Rechts
Gerichtsstand: Hamburg

Vorstandsmitglieder:
Prof. Dr. Jörg F. Debatin (Vorsitzender)
Dr. Alexander Kirstein
Ricarda Klein
Prof. Dr. Dr. Uwe Koch-Gromus


More information about the R-help mailing list