On Jul 16, 2011, at 12:09 PM, Thomthom wrote:
Hi everyone!
I tried to look up in the previous topics whether there was something
similar to my question but I think there's nothing corresponding...
Anyway! Here is my problem:
I have a plot (qplot()) in which I want to insert axis labels with the
following text:
kg NH4+ N-equiv. * ha-1 yr-1 (well... 4 smaller and down and + as a
power
(the same for the -1) but I am sure you understood what I meant).
So, in my code, I typed :
qplot(...., xlab="Amount of N-fertilizer" expression(kg NH[4]^+ N-
equiv. *
ha^-1 yr^-1))
I have never see a successful concatenation of regular text in quotes
with expression(...), so my efforts were focussed on making a
sytactically correct expression:
plot(1~1, xlab=expression(Amount~of~N-fertilizer~kg~NH[4]^"+"*"*"*N-
equiv.~
ha^-1*yr^-1) )
You need to forget about spaces as separators since they are ignored,
and use either "~" or "*" as connectives and that also means that if
you want "*" to appear, it needs to be quoted.
plot(1~1, xlab=expression(Amount~of~N-fertilizer~kg~ NH[4]^ "+" *
"*" * N-equiv.~
ha^-1 * yr^-1) ) # spaces added bak to show grouping, but they are
still ignored.
I'm guessing you want the last part in parens:
plot(1~1, xlab=expression(Amount~of~N-fertilizer~kg~ NH[4]^ "+" *
group("(", list( N-equiv.~ ha^-1 * yr^-1),
")" ))
--
David
but I don't get what I expect... everything after the first "^" is
considered as a power, whereas I would like to have only the + and
the -1 as
a power.
Is there a way to obtain what I want? somehow to split up the
expression so
I don't get everything put at the power of NH4.
I already thank you guys for your help!!!
Thomthom
--
View this message in context:
http://r.789695.n4.nabble.com/expression-and-axis-labels-tp3672050p3672050.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
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.
David Winsemius, MD
West Hartford, CT
______________________________________________
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.