Skip to content
Back to formatted view

Raw Message

Message-ID: <CAMLL7bkodAbM7m-FQMURQfFO19jawfTcgQqYWqwrbL6xKVD0Xw@mail.gmail.com>
Date: 2013-12-10T11:04:55Z
From: Oscar PerpiƱan
Subject: contours in SpatialPixelsDataFrame
In-Reply-To: <CAG4NReKBY2gLGDJQseZWU5S4=+yb5q8yK8S0+LCs-+P4SKOQAg@mail.gmail.com>

Hi,

spplot for SpatialPixelsDataFrame is built upon lattice::levelplot.
Thus, you can use most of its arguments in spplot. For your problem
you have to set "contour=TRUE" and "region=FALSE". Moreover, you can
customize the labels with (surprise!) "labels". This is documented in
the help page of lattice::panel.levelplot:

library(sp)
data(meuse.grid)
m <- SpatialPixelsDataFrame(points = meuse.grid[c("x", "y")],
    data = meuse.grid)

spplot(m["dist"],
       contour=TRUE, region=FALSE,
       labels=list(cex=0.6))

Best,

Oscar.
-----------------------------------------------------------------
Oscar Perpi??n Lamigueiro
Dpto. Ingenier?a El?ctrica (ETSIDI-UPM)
Grupo de Sistemas Fotovoltaicos (IES-UPM)
URL: http://oscarperpinan.github.io
Twitter: @oscarperpinan


2013/12/9 Agustin Lobo <alobolistas at gmail.com>:
> I have a set of regularly distributed points (a grid) as a SpatialPoints DF.
> In order to display the distribution of a continuos varaible in the data table,
> I transform to SpatialPixelsDataFrame (using gridded(a) <- TRUE)
> and after calculating the dimensions of the grid I use rasterize() to convert
> to raster and then use rasterVIS::levelplot()
>
> My question is, can equivalent contours be drawn directely on the
> SpatialPixelsDataFrame object
> to skip the tansform to raster?
> I've tried with spplot(), but get filled intervals, not line contours.
>
> Thanks
>
> Agus
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo