Dear expeRts,
I would like to use LaTeX-like symbols in keys via plotmath. Below is a minimal
example. I get:
Error in fun(key = list(x = 0.5, y = 0.8, text =
list(list(expression(paste("(", :
first component of text must be vector of labels
What's wrong? How can I create the required vector (of expressions)?
Cheers,
Marius
library(lattice)
val <- matrix(1, nrow = 10, ncol = 3)
nplot <- 10
labs <- sapply(1:3, function(i) substitute(expression(paste("(",i,"),
",l==len,"mm",sep="")), list(len=2*i)))
myplot <- xyplot(0~0,
panel=function(...){
for(i in 1:3){
panel.xyplot(1,val[,i],type="l")
panel.text(2,val[nplot,i],label=paste("(",i,")",sep=""))
}
},
key = list(x=0.5,y=0.8,text=list(labs),
align=TRUE,transparent=TRUE))
myplot
______________________________________________
[email protected] 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.