[R-sig-Geo] a question on lattice contourplots

Tim Appelhans tim.appelhans at gmail.com
Sat Jul 28 20:04:41 CEST 2012


Hey Martin,
again me. You can achieve this with the panel.filledcontour() function 
that I sent you. You just need to set the fill.cont to TRUE.
If you are looking for a built in lattice equivalent for 
filled.contour() I think you are out of luck. Though I suggest ,to be 
sure you ask Deepayan Sarkar directly. In the end he's the author of the 
lattice package.
Alternatively you could ask Paul Murrell as he's the author of the grid 
package. I am sure he will be able to answer your question and give you 
all the background on why it may or may not be possible.

Cheers
Tim


On 28/7/2012 13:50, Martin Ivanov wrote:
> Dear R users,
>
> I am still new to lattice but I am motivated to get to grips with it.
> Is it possible to produce the following "traditional R" filled.contour 
> graph with some equivalent trellis function?
>
> library(lattice);
> heights <- c(90, 100, 120, 140, 160, 180, 195);
> data(volcano);
> filled.contour(volcano, levels=heights, col=terrain.colors(6))
>
> All my attempts to achieve that with the trellis levelplot were 
> futile, e.g.:
> levelplot(volcano, at=heights, col.regions=terrain.colors(6));
>
> The difference actually is in the interpolation: the filled.contour 
> regions are smooth, while those of levelplot are pixelled.
> I tried to see what interpolation filled.contour actually does, but I 
> could not see the code of filled.contour:
> the  actual function is called from the internal R code 
> (.Internal(filledcontour, ...)), which I do not know how to see.
> How could I look into the code of the internal R filledcontour?
> I know that levelplot is the lattice equivalent of image, but does 
> filled.contour also have a lattice eqivalent?
>
> As an alternative, is it possible to fill the regions between the 
> contour lines in the following plot:
> levelplot(volcano, at=heights, col.regions=terrain.colors(6), 
> contour=TRUE, region=FALSE)
> without plotting the contourlines themselves?
>
> Thank You very much for Your attention. Any suggestions will be 
> appreciated.
>
> Best regards,
> Martin
>
>

-- 
#####################################
Tim Appelhans
Department of Geography
Environmental Informatics
Philipps Universität Marburg
Deutschhausstraße 12
35032 Marburg (Paketpost: 35037 Marburg)
Germany

Tel +49 (0) 6421 28-25957



More information about the R-sig-Geo mailing list