[R] Lattice fails to draw insets

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Oct 18 23:01:43 CEST 2007


On 10/18/07, Sebastian Weber <sebastian.weber at physik.tu-darmstadt.de> wrote:
> 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.

Yes, I realized this during the freeze prior to R-2.6, and made some
temporary fixes which are part of lattice 0.17-1 (uploaded a couple of
days ago). This may or may not solve your problem. If not, please give
a reproducible example, as it would help me put a more proper fix in
place.

Note that in most situations, a whole new xyplot() is probably
overkill; just set suitable xscale and yscale for your viewport, and
call panel.xyplot().

-Deepayan

> 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.
>
> Greetings,
>
> Sebastian Weber



More information about the R-help mailing list