栅格图中的等距图例
Equally spaced legend in a raster plot
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 那样等间距。
我不清楚这个问题,但我认为你可以使用 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))))
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 那样等间距。
我不清楚这个问题,但我认为你可以使用 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))))