[R] Lattice fails to draw insets

Sebastian Weber sebastian.weber at physik.tu-darmstadt.de
Thu Oct 18 09:16:13 CEST 2007

Hello all lattice experts!

I'm currently trying to plot inset figures in my lattice graphics. The
plot is composed out of two panels and in each panel I want to show an
inset figure which is a closeup of the data in each panel. Thus in each
panel I call xyplot again to plot the inset which I place in a grid
viewport. Nevertheless, once my first inset plot is drawn, lattice
aborts with an error message saying that some current.row() and
current.columns() function are not set any more. It looks to me that
lattice saves its current state while doing a plot in global variables
and this becomes messed up whenever I'm calling lattice while plotting
another plot as this resets those global variables. Is there some good
workaround? My current solution is very crapy: I only setup the inset
viewports while doing the major plot and then insert the inset plots by
calling print(insetplot##, draw.in="insetvp##"). However there should be
a way to circumvent this very cumbersome way.

Any ideas would be great. Thanks in advance.


Sebastian Weber

More information about the R-help mailing list