Is there a way to create a sequence over colors in R?
for example, anything like:
seq("#000000", "#999999", length=20)
Is there a way to create a sequence over colors in R?
for example, anything like:
seq("#000000", "#999999", length=20)
See colorRampPalette
and the related colorRamp
function.
palette <- colorRampPalette(colors=c("#000000", "#FFFFFF"))
cols <- palette(20)
plot(1:20, col=cols, pch=16, cex=3)
For some other interesting options, check out the colorspace package, loading it and then doing example(rainbow_hcl)
and then, if you're intrigued by what you see, vignette("hcl-colors")
.
© 2022 - 2024 — McMap. All rights reserved.