R 展开光栅绘图的定性调色板
我想扩展颜色的定性调色板,以便获得包含更多信息的光栅地图 我一直在使用R 展开光栅绘图的定性调色板,r,colors,raster,R,Colors,Raster,我想扩展颜色的定性调色板,以便获得包含更多信息的光栅地图 我一直在使用rasterVis软件包,对于一个特殊的绘图,我需要比成对的调色板更多的颜色 levelplot(..., par.settings = rasterTheme(region = brewer.pal(10,'Paired')), at=seq(0,5000,500), ...) 通过这种配置,我得到了一个从0到5000乘以200的光栅。通过光栅主题函数,我可以根据配对调色板为绘图使用1
rasterVis
软件包,对于一个特殊的绘图,我需要比成对的
调色板更多的颜色
levelplot(...,
par.settings = rasterTheme(region = brewer.pal(10,'Paired')),
at=seq(0,5000,500),
...)
通过这种配置,我得到了一个从0到5000乘以200的光栅。通过光栅主题
函数,我可以根据配对
调色板为绘图使用10种离散颜色
成对的
调色板只有12种颜色,如果我想要25种颜色(对于从0到5000乘以200单位的光栅),我必须使用预定义的调色板,这意味着使用顺序调色板
levelplot(...,
par.settings = YlOrRdTheme,
at=seq(0,5000,200),
...)
如何在非顺序调色板中使用25种不同的颜色?我应该手动创建调色板还是有创建随机调色板的功能
谢谢大家! 该库有两个用于创建随机颜色的函数,其中包含用于选择所需颜色数的参数。使用distinctcolorpette
功能的示例:
# load the library
library(randomcoloR)
# define the number of colors
k <- 25
# generate the colors
colors <- distinctColorPalette(k = k)
# proof - plot the colors
xleft <- seq(1,k,1)
xright <- xleft+1
ybottom <- rep(0,k)
ytop <- ybottom+1
plot(1, 1, xlim = c(0, k), type = "n", axes = FALSE, bty = "n", xlab = "",
ylab = "")
rect(xleft = xleft, ybottom = ybottom, xright = xright, ytop = ytop, col =
colors, border = "white")
#加载库
图书馆(彩色)
#定义颜色的数量
K