[R-sig-Geo] Problems with function gplot from rasterVis

Oscar Perpiñán Lamigueiro oscar.perpinan at upm.es
Mon Feb 27 17:51:40 CET 2012


Manuel Spínola <mspinola10 at gmail.com> writes:


>> library(raster)> library(rasterVis)> r = raster(jabali$map)> p = gplot(r) + geom_tile(aes(fill = value)) + geom_point(loc, aes(X,Y))Error: ggplot2 doesn't know how to deal with data of class uneval
>
> I can plot the map, but I can get to plot the points on the map.  The
> object "loc" is a data frame with the locations given by X and Y.

Hi Manuel,

Try this:

gplot(r) + geom_tile(aes(fill = value)) + geom_point(aes(X,Y), data=loc)

The arguments of geom_point are mapping and then data, but you were
using them in reverse order.

Best,

Oscar.

-- 
Oscar Perpiñán Lamigueiro
Dpto. de Ingeniería Eléctrica
EUITI-UPM

http://procomun.wordpress.com



More information about the R-sig-Geo mailing list