Skip to content
Back to formatted view

Raw Message

Message-ID: <87zjtfccnk.fsf@gmail.com>
Date: 2013-07-22T06:49:19Z
From: Oscar PerpiƱan
Subject: Remove grey area when using gplot (rasterVis)
In-Reply-To: <CABkCotQjotTM3q59n8p4CS8i=83G6MhPrzfYEkf-8wC+4Ooq-w@mail.gmail.com>

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