Title: 270 'NCL' Color Tables in R Language
Description: 'NCL' (NCAR Command Language) is one of the most popular spatial data mapping tools in meteorology studies, due to its beautiful output figures with plenty of color palettes designed by experts https://www.ncl.ucar.edu/index.shtml. Here we translate all 'NCL' color palettes into R hexadecimal RGB colors and provide color selection function, which will help users make a beautiful figure.
Version: 0.1.0
Depends: R (≥ 3.1)
Imports: magrittr
License: GPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
Suggests: testthat, covr
NeedsCompilation: no
Packaged: 2021-04-22 12:13:18 UTC; kongdd
Author: Dongdong Kong ORCID iD [aut, cre]
Maintainer: Dongdong Kong <kongdd.sysu@gmail.com>
Repository: CRAN
Date/Publication: 2021-04-23 10:40:02 UTC

rcolors: 270 'NCL' Color Tables in R Language

Description

'NCL' (NCAR Command Language) is one of the most popular spatial data mapping tools in meteorology studies, due to its beautiful output figures with plenty of color palettes designed by experts <https://www.ncl.ucar.edu/index.shtml>. Here we translate all 'NCL' color palettes into R hexadecimal RGB colors and provide color selection function, which will help users make a beautiful figure.

Author(s)

Maintainer: Dongdong Kong kongdd.sysu@gmail.com (ORCID)


270 ncl colors

Description

-rcolors: list of 270 colors

Usage

colors_group

Format

An object of class list of length 34.

References

https://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml

Examples

str(rcolors[1:6])
str(colors_group[1:6])

Get and interpolate colors

Description

Get and interpolate colors

Usage

get_color(col, n = NULL, show = FALSE)

Arguments

col

color name in the rcolors or a vector of colors

n

Integer, default is length of col

show

Boolean, whether to visualize those colors?

Details

⁠supported col names⁠: 270 ncl colors (names(rcolors)) and 35 RColorBrewer colors (names(colors_group$brewer)).

Value

A character vector with elements of 7 or 9 characters, "#" followed by the red, blue, green and optionally alpha values in hexadecimal (after rescaling to 0 ... 255). The optional alpha values range from 0 (fully transparent) to 255 (opaque).

R does not use ‘premultiplied alpha’.

See Also

show_cols()

Examples

print(names(rcolors[1:6]))
print(names(colors_group$brewer))
get_color("amwg_blueyellowred", n = 20)

read colors from ncl

Description

read colors from ncl

Usage

read_color(file)

Arguments

file

ncl rgb file

Value

A character vector with elements of 7 or 9 characters, "#" followed by the red, blue, green and optionally alpha values in hexadecimal (after rescaling to 0 ... 255). The optional alpha values range from 0 (fully transparent) to 255 (opaque).

R does not use ‘premultiplied alpha’.


Show list of colors

Description

Show list of colors

Usage

show_cols(colors_list, margin = 8, fontsize = 1, family = NULL)

show_cols_brewer(colors_list)

show_col(colors, labels = TRUE, borders = NULL, cex_label = 1, nrow = NULL)

Arguments

colors_list

A list objects filled with colors_list or a color vector

margin

margin in the left

family, fontsize

font family and size of color names in the left

colors

a character vector of colors

labels

boolean, whether to show the hexadecimal representation of the colours in each tile

borders

colour of the borders of the tiles

cex_label

size of printed labels, works the same as cex parameter of plot()

nrow

integer, number of rows

Examples

print(names(colors_group))
show_cols(colors_group$rainbow, margin = 14)