Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法在 R 中创建颜色序列?
例如,任何类似的东西:
seq("#000000", "#999999", length=20)
见colorRampPalette及相关colorRamp功能。
colorRampPalette
colorRamp
palette <- colorRampPalette(colors=c("#000000", "#FFFFFF")) cols <- palette(20) plot(1:20, col=cols, pch=16, cex=3)
对于其他一些有趣的选项,请查看colorspace包,加载它然后执行example(rainbow_hcl),然后,如果您对所看到的内容感兴趣,vignette("hcl-colors").
example(rainbow_hcl)
vignette("hcl-colors")