library(raster)
library(viridis)
data(volcano)
volcanoR <- raster(volcano)
breakpoints <- c(94,100,120,140,160,180,185, 189, 195)
par(mfrow = c(1, 2))
plot(volcanoR, main = "1")
plot(volcanoR, breaks = breakpoints, col = viridis(length(breakpoints) -1), main = "2")
In the plot 2, you see that the legend labels are very close to each other and even overlapping. Is there any way, I can have them not overlapping and equal spaced like in Fig 1.
This question is not clear to me but I think you can do this using levelplot
:
library(raster)
library(lattice)
data(volcano)
volcanoR <- raster(volcano)
breakpoints <- c(94,100,120,140,160,180,185, 189, 195)
levelplot(volcano, at=breakpoints, labels=breakpoints,
par.settings=list(regions=list(col=topo.colors(8))))