Reputation: 1120
Complete R noob, need help plotting a raster with a good scale.
rast <- raster("accessibility.tif")
pal <- colorRampPalette(c("green","red"))
plot(rast,
col = pal(10),
zlim = c(0,180))
This is what the output is:
See, all the values after 180 are simply not plot.
It's like they're cut out of the scale.
This wont do as there are a good minority of values after 180 that go till 3500.
I don't want the scale to go from 0 - 180,
I need it to go from 0 - 180+
I want all of those points to be plot in Red too.
Thank You for your help
Upvotes: 0
Views: 986
Reputation: 47091
You can do something like this:
library(raster)
rast <- raster("accessibility.tif")
r <- clamp(rast, 0, 180)
pal <- colorRampPalette(c("green","red"))
plot(r, col = pal(10))
Upvotes: 2