sequence over colors in R
Asked Answered
D

1

10

Is there a way to create a sequence over colors in R?

for example, anything like:

 seq("#000000", "#999999", length=20)
Deadening answered 21/2, 2013 at 19:5 Comment(0)
B
14

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)

enter image description here

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").

Biddy answered 21/2, 2013 at 19:23 Comment(1)
@RicardoSaporta -- Always especially glad to help folks who are helping others in turn! Cheers.Loathly

© 2022 - 2024 — McMap. All rights reserved.