How can I create raster plots with the same colour scale in R

后端 未结 6 843
盖世英雄少女心
盖世英雄少女心 2021-01-31 10:36

I\'m creating some maps from raster files using the \"raster\" package in R. I\'d like to create comparison rasters, showing several maps side by side. It\'s important for this

6条回答
  •  粉色の甜心
    2021-01-31 11:00

    A pretty simple solution that should usually work (e.g. with the "plot" function in the raster package) is to set "z axis" limits (which control the colors and the color legend).

    E.g. you can do something like: plot(d, zlim=c(0,1))

    where d is a stacked raster object. Or, if you have a bunch of separate rasters d1, d2, d2..., you can just do: plot(d1, zlim=c(0,1)) plot(d2, zlim=c(0,1)) plot(d3, zlim=c(0,1)) ...

提交回复
热议问题