Re: [R] Base and lattice graphics on the same graphics page

From: Deepayan Sarkar <>
Date: Wed 30 Mar 2005 - 14:59:51 EST

On Tuesday 29 March 2005 22:32, John Maindonald wrote:
> Although base graphics does not mix with lattice in the one graph,
> I've found that print.trellis(position=..., ) and the use of
> par(fig=...)
> to put regular and trellis graphics on the one graphics page works
> like a treat, at least in version 2.0.1 of R. [Base graphics
> functions that are themselves inconsistent with par(fig=...) are
> obviously disallowed.]
> I am wondering whether there are caveats of which I and others
> should be aware, or whether there is a risk that the ongoing
> development of R's graphics abilities will render such a cohabitation
> unworkably fractious.

Paul would know better, but I think that's unlikely. In fact, the gridBase package allows you to do use grid (and hence lattice) functions to add to a base plot, as well as (I didn't realize this before) the other way round. The only caveat is that resizing the device may mess things up.

You may have to be careful with new devices. Your example pasted on a fresh session (tested only on r-devel) starts a new page for the boxplot since it thinks that new=TRUE doesn't make sense (because there's no 'old' plot yet).

Deepayan mailing list PLEASE do read the posting guide! Received on Wed Mar 30 15:06:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:57 EST