Description Usage Arguments Details Value Author(s) See Also Examples
Get a vector of hex colors (lower case characters) or a hex color function factory from a designated (named) palette.
1 2 3 4 5 |
palette |
Character, the palette name (case insensitive). |
n |
Numeric, the length of color vector. Default NULL, which indicates that the function will return a function to generate color vectors. |
show |
Logical, whether display the palette. Default FALSE. If |
mode |
Character, either "na.fill", "no.fill", or "repeat.fill". If
|
... |
Other arguments to pass to the function. E.g.,
|
getPalette
(named_pal
) generally gets hex value of the
colors in a designated palette. The palettes include Aetna palette, palette
in packages RColorBrewer, ggthemes and viridis.
You can run palettes.info
to check the
palettes information.
The following palettes are available:
'aetclassic_green', 'aetclassic_blue', 'aetclassic_teal', 'aetclassic_cranberry', 'aetclassic_orange', 'aetclassic_violet', 'aetnew_violet', 'aetnew_teal', 'aetnew_cranberry'
'aetdiv_violet', 'aetdiv_teal', 'aetdiv_cranberry'
'aetdiv_violet', 'aetdiv_teal', 'aetdiv_cranberry'
'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'
normal:
'calc', 'economist', 'economist_white', 'excel_line', 'excel_fill', 'excel_new', 'few', 'fivethirtyeight', 'gdocs', 'pander', 'stata', 'stata1', 'stata1r','statamono','hc', 'darkunica','wsj', 'wsj_rgby', 'wsj_red_green', 'wsj_black_green', 'wsj_dem_rep', 'colorblind'
tableau (see tableau_color_pal
):
"tableau10", "tableau20", "tbl_colorblind", "tbl_seattle_grays", "tbl_traffic", "tbl_miller_stone", "tbl_superfishel_stone", "tbl_nuriel_stone", "tbl_jewel_bright", "tbl_summer", "tbl_winter", "tbl_gnorte", "tbl_rdbubw", "tbl_pupkgy", "tbl_hue_circle", "tbl_classic10", "tbl_classic10_medium", "tbl_classic10_light", "tbl_classic20", "tbl_classic_gray5", "tbl_classic_colorblind", "tbl_classic_traffic_light", "tbl_classic_pugy6", "tbl_classic_pugy12", "tbl_classic_gnor6", "tbl_classic_gnor12", "tbl_classic_burd6", "tbl_classic_burd12", "tbl_classic_cyclic"
"tbl_orbu_div", "tbl_rdgn_div", "tbl_gnbu_div", "tbl_rdbu_div", "tbl_rdbl_div", "tbl_gdpu_div", "tbl_rdgngd_div", "tbl_sunset_sunrise_div", "tbl_orbuwi_div", "tbl_rdgnwi_div", "tbl_gnbuwi_div", "tbl_rdbuwi_div", "tbl_rdblwi_div", "tbl_orbu_light_div", "tbl_temperature_div", "tbl_classic_rdgn", "tbl_classic_rdbu", "tbl_classic_rdbl", "tbl_classic_area_rdgn", "tbl_classic_orbu", "tbl_classic_gnbu", "tbl_classic_rdwign", "tbl_classic_rdwibl", "tbl_classic_orwibu", "tbl_classic_rdwibl_light", "tbl_classic_orwibu_light", "tbl_classic_rdwign_light", "tbl_classic_rdgn_light"
"tbl_bugn_seq", "tbl_blue_light", "tbl_orange_light", "tbl_blue", "tbl_orange", tbl_green", "tbl_red", "tbl_purple", "tbl_brown", "tbl_gray", "tbl_gray_warm", "tbl_bute", "tbl_orgd", "tbl_gngd", "tbl_rdgd", "tbl_classic_green", "tbl_classic_gray", "tbl_classic_blue", "tbl_classic_red", "tbl_classic_orange", "tbl_classic_area_red", "tbl_classic_area_green", "tbl_classic_area_brown"
solarized (see solarized_pal
):
'solarized','solarized_red', 'solarized_yellow', 'solarized_orange','solarized_magenta','solarized_violet', 'solarized_blue', 'solarized_cyan', 'solarized_green'
'megma', 'inferno', 'plasma', 'viridis', 'cividis'
'rainbow'
'terrain', 'topo', 'heat'
'cm'
n
is not NULL: return a vector of Hex colors
n
is NULL: return the color generation function (function factory).
Yiying Wang, wangy@aetna.com
The palettes majorly come from RColorBrewer, ggthemes,
and viridis. You can also refer to colorspace to build
your own palette.
Refer to data:palettes.info
to check built palettes info. And you
can use the generalized parser function hex_colors
to get hex
colors more conveniently.
1 2 3 4 5 6 7 8 9 | ## Not run:
## Get the entire Aetna classic green palette
f <- getPalette("aetclassic_gre") # returns a function factory
f(8) # returns first 8 colors
## Get 7 colors from palette 'terrain'
named_pal("terrain", 7)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.