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")
在图2中,您会看到图例标签彼此非常接近,甚至重叠。有什么办法,我可以让它们不重叠且等距,如图1所示。