Skip to content
Back to formatted view

Raw Message

Message-ID: <eb555e660809171344u5f37fd3fye18fffffeedee68c@mail.gmail.com>
Date: 2008-09-17T20:44:47Z
From: Deepayan Sarkar
Subject: Creating smooth color regions with panel.contourplot()
In-Reply-To: <eb555e660809171325i7de50270g35c8afd437039764@mail.gmail.com>

On Wed, Sep 17, 2008 at 1:25 PM, Deepayan Sarkar
<deepayan.sarkar at gmail.com> wrote:
> On Wed, Sep 17, 2008 at 1:12 PM, David Carslaw
> <d.c.carslaw at its.leeds.ac.uk> wrote:
>>
>> I think this is a very useful function that I imagine has wide appeal -
>> thanks.  Using the code below produces the plot OK but when I try and
>> copy/save it (as a metafile) I receive the following error and an hourglass:
>>
>> Error: invalid graphics state
>>
>> [using XP, 2.72, lattice 0.17.13]
>
> Yes, that's the drawback of mixing grid and base graphics (even
> resizing the screen device will not work). However, if you explicitly
> start a device and plot to it, instead of copying from a screen
> device, that should work fine.

That isn't completely accurate. To ensure that the plot doesn't start
a new page, you need something like

pdf()
plot.new()
levelplot(volcano, panel = panel.filledcontour,
          col.regions = terrain.colors,
          cuts = 25,
          plot.args = list(newpage = FALSE))
dev.off()

-Deepayan