powered by
Discrete scale
dscale(x, palette, na.value = NA)
vector of discrete values to scale
aesthetic palette to use
aesthetic to use for missing values
with(mtcars, plot(disp, mpg, pch = 20, cex = 3, col = dscale(factor(cyl), pal_brewer()) ))
Run the code above in your browser using DataLab