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

Martin Ivanov martin.ivanov at ifg.uni-tuebingen.de
Sat Jul 28 13:50:06 CEST 2012


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


-- 
Dr. Martin Ivanov
Eberhard-Karls-Universität Tübingen
Mathematisch-Naturwissenschaftliche Fakultät
Fachbereich Geowissenschaften
Water & Earth System Science (WESS)
Keplerstraße 17, 72074 Tübingen, Deutschland
Tel. +4970712975023



More information about the R-sig-Geo mailing list