[R] Thanks: Mathematical annotation axis in lattice
Coster, Albart
Albart.Coster at wur.nl
Wed Jul 8 09:01:39 CEST 2009
Hello,
thanks for the two replies. The following code worked as expected:
pos <- 1:10
lab <- letters[pos]
ll <- parse(text = paste(pos,"*phi[",lab,"]",sep = ""))
xyplot(1:10~1:10,scales = list(x = list(labels = ll,at = 1:10)))
Best regards,
Albart
-----Original Message-----
From: Coster, Albart
Sent: Tue 7/7/2009 1:27 PM
To: r-help-request at r-project.org
Subject: Mathematical annotation axis in lattice
Dear list,
making mathematical expressions in plots is not difficult: expression(phi[1]) for example. At this moment I am stuck in creating a vector of expressions:
pos <- 1:10
lab <- letters[pos]
Now, I would like to create a vector of expressions which I could use for labeling the x-axis of a lattice plot.
ll <-
as.expression(paste(pos," phi[",lab,"]",sep = "")
xyplot(1:10~11:10,scales = list(x = list(labels = ll,at = 1:10)))
does not work. I read about the function substitute, but that did not solve it.
Could you recommend me how I should do this?
Thanks in advance,
Albart Coster
Wageningen Universiteit
Netherlands
More information about the R-help
mailing list