On Aug 31, 2010, at 11:34 AM, Thomas Maier wrote:

I'd like to annotate a lattice plot, e.g. xyplot, with text containing both Greek letters and variable values. In the base graphics plot command this
can be accomplished with e.g. main =
substitute(paste(lambda,"=",var),list(var=var)), where var is a variable
that contains the value.

Try wrapping as.expression around that substitute argument. Both of these seem to deliver desired results.

> var=5
> xyplot(1~1, main = as.expression(bquote(lambda==.(var))))
> xyplot(1~1, main = as.expression(substitute(paste(lambda,"=",var),list(var=var))))

When I try to do this in xyplot, I get the error
message "object 'lambda' not found". Any ideas on how to do this in xyplot?
Thanks for the help!


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.

Reply via email to