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