繪製使用gplot()
光柵產生一個很好的地圖,e.g: 防止灰色背景成光柵gplot與日誌縮放的顏色
由於可變規模(人口)覆蓋許多數量級,對數標度是優選的。但是,當這個被應用於彩色可變(通過添加trans='log'
參數scale_fill_gradient
),人口零的領域最終灰色:
有誰知道如何防止這種情況?這是我正在使用的代碼:
require(raster, rgdal, ggplot2)
pop = readGDAL("usa_population.tif")
p = raster(pop, layer=1, values=TRUE)
s <- stack(p)
gplot(s) + geom_tile(aes(fill = value)) +
scale_fill_gradient(low = 'white', high = 'blue', trans='log')
在此先感謝。
我的猜測:na.value =「grey50」被用於log(0)? – baptiste