rgb - How to create a color scale between two given colors in GNU R -
i have 2 colors rgb-codes a <- "#000099"
, b <- "#ccccff"
let's need 10 colors, , these colors need start a
, end color b
, , other colors "between" these 2 "equal distance"...
so, looking like
givecolorvector(start="#000099", end="#ccccff", length=10)
and should return vector this:
[1] "#000099" "0000ff" (...) "6666ff" "#7777ff" "#8888ff" "#9999ff" "#ccccff"
how do in r?
use colorramppalette
so:
<- "#000099" b <- "#ccccff" colorramppalette(colors=c(a,b))(10) [1] "#000099" "#1616a4" "#2d2daf" "#4444bb" "#5a5ac6" "#7171d1" "#8888dd" [8] "#9e9ee8" "#b5b5f3" "#ccccff"
in place of a
, b
use r's color names, such colors=c("blue","green")
, , can use more 2 colors if like.
Comments
Post a Comment