[R-sig-Geo] Remove grey area when using gplot (rasterVis)

Oscar Perpiñán Lamigueiro oscar.perpinan at gmail.com
Mon Jul 22 08:49:19 CEST 2013


Hello,

Use na.value='transparent' inside scale_fill_gradient:

theme_set(theme_bw())
gplot(s) + geom_tile(aes(fill = value)) + 
  facet_wrap(~ variable) + 
  scale_fill_gradient(low = "white", high = "blue", na.value='transparent') +
  coord_equal()

Best,

Oscar

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

> Dear list members,
>
> How can I remove the grey area that appear when using gplot from rasterVis
>
> Here is the reproducible example that come from the example of gplot:
>
> r <- raster(system.file("external/test.grd", package="raster"))
> s <- stack(r, r*2)
> names(s) <- c("meuse", "meuse x 2")
>
> theme_set(theme_bw())
> gplot(s) + geom_tile(aes(fill = value)) +
>   facet_wrap(~ variable) +
>   scale_fill_gradient(low = "white", high = "blue") +
>   coord_equal()
>
>
> Best,
>
> Manuel


-- 
Oscar Perpiñán Lamigueiro
Grupo de Sistemas Fotovoltaicos (IES-UPM)
Dpto. Ingeniería Eléctrica (EUITI-UPM)
URL: http://procomun.wordpress.com
Twitter: @oscarperpinan
LinkedIn: http://www.linkedin.com/in/oscarperpinan



More information about the R-sig-Geo mailing list