[R] Superscripts in axis label

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Wed Aug 12 18:29:59 CEST 2009


oops, there was a little problem with an automated text replacement in
my last post. m^3 should be read as m ^ 3 (without white space).

or, using curly brackets for safety, try

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

hth.


Buckmaster, Sarah schrieb:
> Thanks Eik, I just tried the following:
>
> plot(sm~wf, type="n", xlab="Levels of droughting gradient", ylab=expression("Soil moisture content"~~bgroup("(",m^3*m^{-3},")"))), bty="l", font.main="2", pch=16, las=1, cex.lab="1.13")
>
> and got error messages, saying 'unexpected string constant' - have I missed something?
>
> Sarah
>
> ________________________________________
> From: Eik Vettorazzi [E.Vettorazzi at uke.uni-hamburg.de]
> Sent: 12 August 2009 16:41
> To: Buckmaster, Sarah
> Cc: r-help at r-project.org
> Subject: Re: [R] Superscripts in axis label
>
> 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
>   

-- 
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