getPalette | R Documentation |
generates colour palette from RColorBrewer
getPalette
was renamed to get_palette
for more consistent
function naming nomenclature in OCMSutility
. Usage is still exactly the same
getPalette(n = NULL, palette = NULL, preview = FALSE)
n |
numeric; default NULL. number of colours; cannot exceed 335. when NULL, gives all colours (in palette, if specified). |
palette |
character; allows you to specify a RColorBrewer palette by name Diverging BrBG, PiYG, PRGn, PuOr, RdBu, RdGy, RdYlBu, RdYlGn, Spectral Qualitative Accent, Dark2, Paired, Pastel1, Pastel2, Set1, Set2, Set3 Sequential Blues, BuGn, BuPu, GnBu, Greens, Greys, Oranges, OrRd, PuBu, PuBuGn, PuRd, Purples, RdPu, Reds, YlGn, YlGnBu, YlOrBr, YlOrRd |
preview |
logic; default FALSE; when set, gives preview of colour |
vector of HEX colours, if full set to TRUE, gives all 335 colours, else gives n numbers
getPalette(n=5, palette = 'Set3')
# ->
get_palette(palette = c('Set1','Dark2'), preview = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.