getColFromPal: Get The Colors Vector From A Named Palette

Description Usage Arguments Value See Also Examples

View source: R/utils.R

Description

Get hex color vector of a named palette from RColorBrewer, ggthemes or grDevices. You can show_col the vector to see the effects.

Usage

1
getColFromPal(palname = NULL, n = 6)

Arguments

palname

name of the palette. Default NULL to get echarts default. Could be:

  • RColorBrewer palettes: Including 'BrBG', 'PiYG', 'PRGn', 'PuOr', 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'Spectral', 'Accent', 'Dark2', 'Paired', 'Pastel1', 'Pastel2', 'Set1', 'Set2', 'Set3', 'Blues', 'BuGn', 'BuPu', 'GnBu', 'Greens', 'Greys', 'Oranges', 'OrRd', 'PuBu', 'PuBuGn', 'PuRd', 'Purples', 'RdPu', 'Reds', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd'

  • ggthemes palettes: 'calc', 'economist', 'economist_white', 'economist_stata', 'excel', 'exel_fill', 'excel_line', 'excel_new', 'few', 'fivethirtyeight', '538', 'manyeyes', 'gdocs', 'pander', 'tableau', 'stata', 'stata1', 'stata1r', 'statamono', 'ptol', 'tableau20', 'tableau10medium', 'tableaugray', 'tableauprgy', 'tableaublrd', 'tableaugnor', 'tableaucyclic', 'tableau10light', 'tableaublrd12', 'tableauprgy12', 'tableaugnor12', 'hc', 'darkunica', 'solarized', 'solarized_red', 'solarized_yellow', 'solarized_orange', 'solarized_magenta', 'solarized_violet', 'solarized_blue', 'solarized_cyan', 'solarized_green', 'wsj', 'wsj_rgby', 'wsj_red_green', 'wsj_black_green', 'wsj_dem_rep', 'colorblind', 'trafficlight'

  • Aetna official palettes: Including 'aetnagreen', 'aetnablue', 'aetnaviolet', 'aetnaorange', 'aetnateal', 'aetnacranberry'

  • Other palettes: 'rainbow', 'terrain', 'topo', 'heat', 'cm'

n

length of the color vector when the palette is continuous (rain, cm, terrain, topo, heat, ...). Default 6.

Value

color vectors

See Also

RColorBrewer, scales, ggthemes, show_col

Examples

1
2
3
4
5
6
## Not run: 
library(scales)
show_col(getColFromPal('tableau20'))
show_col(getColFromPal('hc'))

## End(Not run)

madlogos/recharts2 documentation built on May 21, 2019, 11:03 a.m.