[R] again troubles with lattice

Thomas Lumley tlumley at u.washington.edu
Thu May 8 18:09:56 CEST 2003

On Thu, 8 May 2003, Deepayan Sarkar wrote:

> You have to print the result of xyplot, which does not happen inside another
> function unless you explicitly call print().
> This is obviously somewhat confusing because base R graphics does not behave
> this way, and has led to many similar questions on this list. help(xyplot)
> has:

Perhaps a FAQ entry?

Q: Why don't lattice/trellis graphics work?

A: The most likely reason is that you forgot to tell R to display the
graph.  Lattice functions such as xyplot() create a graph object, but do
not display it (the same is true of Trellis graphics in S-PLUS).  The
print() method for the graph object produces the actual display.  When you
use these functions interactively at the command line the result is
automatically print()ed, but in source() or inside your own functions you
will need an explicit print() statement.


More information about the R-help mailing list