[R] Mathematical annotation axis in lattice

2009-07-07 Thread Coster, Albart
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

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


[R] Thanks: Mathematical annotation axis in lattice

2009-07-08 Thread Coster, Albart

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-requ...@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

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