|
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 _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
|
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 _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
|
In reply to this post by epaiv01
well, regarding your last question , you just have to change the parameters of levelplot() function: if you read them, they "speak" clearly ;) : if you don0t want contourlines switch contour parameter to False, and if you want your regions to be coloured switch the region parameter to T try levelplot(volcano, at=heights, col.regions=terrain.colors(6), contour=F, region= T) this should work,
Giusepep Calamita
PhD italian National Council of Research - Institute of Methodologies for Environmental Research CNR - IMAA 85050 Tito Scalo - Potenza - Italy |
| Powered by Nabble | Edit this page |
