0

Does any one knows that ,how to remove background gray color when using gplot method in Rastervis? I already try to remove the theme color but it did not work.

r <- raster(system.file("external/test.grd", package="raster"))
s <- stack(r, r*2)
names(s) <- c('meuse', 'meuse x 2')

library(ggplot2)

theme_set(theme_bw())
gplot(s) + geom_tile(aes(fill = value)) +
    facet_wrap(~ variable) +
    scale_fill_gradient(low = 'white', high = 'blue') +
    coord_equal() +
    theme(
            plot.background = element_blank()
            ,panel.grid.major = element_blank()
            ,panel.grid.minor = element_blank()
            ,panel.border = element_blank()
            ,panel.background = element_blank())

enter image description here

4

2 回答 2

0

我已经从 rasterVis 的作者那里得到了答案 https://github.com/oscarperpinan/rastervis/issues/13#comments

于 2014-10-08T12:13:47.557 回答
0

按照@Bingwei 提供的链接,我发现 usingscale_fill_gradient(low = 'white', high = 'blue', na.value=NA))对我有用。注意na.value=NA而不是na.value="white".

于 2018-02-10T23:41:48.623 回答