[R-sig-Geo] contours in SpatialPixelsDataFrame
Oscar Perpiñan
oscar.perpinan at upm.es
Tue Dec 10 12:04:55 CET 2013
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
More information about the R-sig-Geo
mailing list