Title: | Helper functions for using the NMR color palettes |
---|---|
Description: | paletteNMR provides functions to access and browse the set of palettes available for use in publications at NMR. The main palette set is NMR's internal set, but the package also contains palettes for use with other clients' projects, and can be expanded to include other palettes as needed. Call 'vignette("intro", "paletteNMR")' to see more information. |
Authors: | Jerrad Pierce [aut], Julian Ricardo [prg, cre] |
Maintainer: | Julian Ricardo <[email protected]> |
License: | GPL-3 + file LICENSE |
Version: | 1.1.6 |
Built: | 2024-11-17 03:24:42 UTC |
Source: | https://gitlab.com/NMRgroup/paletteNMR |
Check if an object has names
Check if an object has names
checkHasNames(x) ## Default S3 method: checkHasNames(x)
checkHasNames(x) ## Default S3 method: checkHasNames(x)
x |
An object to check for names. |
Confirmation that object has valid names.
Check an object for valid hex colors
Check an object for valid hex colors
Check a list for valid hex colors
Check a vector for valid hex colors
Check a data.frame for valid hex colors
checkValidHex(x) ## Default S3 method: checkValidHex(x) ## S3 method for class 'list' checkValidHex(x) ## S3 method for class 'vector' checkValidHex(x) ## S3 method for class 'data.frame' checkValidHex(x)
checkValidHex(x) ## Default S3 method: checkValidHex(x) ## S3 method for class 'list' checkValidHex(x) ## S3 method for class 'vector' checkValidHex(x) ## S3 method for class 'data.frame' checkValidHex(x)
x |
An object containing colors (as strings) |
Confirmation that object contains only valid colors, or some explanation of errors if it contains invalid ones.
Draw a palette using 'nmr_colors'
draw_palette( scale = "categorical", pal = "quad", set = "O", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, ncols = 1 )
draw_palette( scale = "categorical", pal = "quad", set = "O", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, ncols = 1 )
scale |
String to select colors for categorical or numerical scales |
pal |
String to select palette type (e.g. for categorical, pairs or quads) |
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
ncols |
A number of columns to display in the drawn palette |
A grid of color swatches
draw_palette(scale = "numerical", pal = "nondiverg", set = "BT6", index = 1:4, ncols = 2) draw_palette(scale = "categorical", pal = "quad", set = "O")
draw_palette(scale = "numerical", pal = "nondiverg", set = "BT6", index = 1:4, ncols = 2) draw_palette(scale = "categorical", pal = "quad", set = "O")
Helper function to select names used in calling 'nmr_colors'
get_pal_args( arg_list, colname_str = "(^(scale|pal|set|index|contrast|discrete|interpolate|reverse))" )
get_pal_args( arg_list, colname_str = "(^(scale|pal|set|index|contrast|discrete|interpolate|reverse))" )
arg_list |
A list of arguments used to call the function calling 'get_pal_args' |
colname_str |
A string selecting arguments by name (regex allowed) |
A subset of supplied argument names
A single categorical palette we last used for NEEA in 2020
neeaPalettes_2017
neeaPalettes_2017
A list of 1 dataframe containing separate color palettes
A single categorical palette we last used for Nexant in PY2019
nexantPalettes_2017
nexantPalettes_2017
A list of 1 dataframe containing separate color palettes
Some palettes are loaded in with contrasting colors for use with text. Note: accepts regex statements in arguments.
nmr_colors( scale = c("categorical", "numerical"), pal, set, index = NULL, pal_df = paletteNMR::nmrPalettes_2020 )
nmr_colors( scale = c("categorical", "numerical"), pal, set, index = NULL, pal_df = paletteNMR::nmrPalettes_2020 )
scale |
String to select colors for categorical or numerical scales |
pal |
String to select palette type (e.g. for categorical, pairs or quads) |
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
A named vector containing colors
nmr_colors(scale = "categorical", pal = "lines", set = "All") nmr_colors(scale = "categorical", pal = "quad", set = "O")
nmr_colors(scale = "categorical", pal = "lines", set = "All") nmr_colors(scale = "categorical", pal = "quad", set = "O")
Generate a palette function
nmr_pal( scale = "Categorical", pal = "quad", set = "C", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, interpolate = FALSE, reverse = FALSE, ... )
nmr_pal( scale = "Categorical", pal = "quad", set = "C", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, interpolate = FALSE, reverse = FALSE, ... )
scale |
String to select colors for categorical or numerical scales |
pal |
String to select palette type (e.g. for categorical, pairs or quads) |
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
interpolate |
A boolean toggling whether to interpolate colors |
reverse |
A boolean toggling whether to reverse the palette |
... |
Additional arguents to pass to 'colorRampPalette' |
A (sub)set of colors from an NMR palette, or a set interpolated from one
A dataframe of colors, used to create NMR palettes, along with some extras
nmrColors_2020
nmrColors_2020
A dataframe of color IDs and hex codes
A list of color palettes, divided by category into "Main", "Numerical", "Categorical", and "Extras." Within some categories, there are further subdivisions into Ordinal / Divergent, Time-series / Map, and further lettered subdivisions.
nmrPalettes_2017
nmrPalettes_2017
A list of 10 dataframes, each containing separate color palettes
A list of color palettes broken up by type: categorical, diverging, sequential, maps. Some palettes have sets with different base colors
nmrPalettes_2020
nmrPalettes_2020
A list of 10 dataframes, each containing separate color palettes
Generate a categorical color scale with NMR colors
Generate a colour scale for nmr colors
scale_nmr_color_categorical( pal = "All", set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... ) scale_nmr_colour_categorical( pal = "All", set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
scale_nmr_color_categorical( pal = "All", set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... ) scale_nmr_colour_categorical( pal = "All", set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
pal |
String to select palette type (e.g. for categorical, pairs or quads) |
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
discrete |
A boolean toggling whether the aesthetic is discrete |
interpolate |
A boolean toggling whether to interpolate colors |
reverse |
A boolean toggling whether to reverse the palette |
... |
Additional arguents to pass to 'colorRampPalette' |
A color scale for use in ggplot2 graphics.
scale_nmr_color_diverging
,
scale_nmr_color_sequential
,
scale_nmr_color_orthogonal
Generate a diverging color scale with NMR colors
Generate a colour scale for nmr colors
scale_nmr_color_diverging( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... ) scale_nmr_colour_diverging( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
scale_nmr_color_diverging( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... ) scale_nmr_colour_diverging( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
discrete |
A boolean toggling whether the aesthetic is discrete |
interpolate |
A boolean toggling whether to interpolate colors |
reverse |
A boolean toggling whether to reverse the palette |
... |
Additional arguents to pass to 'colorRampPalette' |
A color scale for use in ggplot2 graphics.
scale_nmr_color_sequential
,
scale_nmr_color_orthogonal
,
scale_nmr_color_categorical
Generate a orthogonal color scale with NMR colors
Generate a colour scale for nmr colors
scale_nmr_color_orthogonal( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... ) scale_nmr_colour_orthogonal( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
scale_nmr_color_orthogonal( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... ) scale_nmr_colour_orthogonal( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
discrete |
A boolean toggling whether the aesthetic is discrete |
interpolate |
A boolean toggling whether to interpolate colors |
reverse |
A boolean toggling whether to reverse the palette |
... |
Additional arguents to pass to 'colorRampPalette' |
A color scale for use in ggplot2 graphics.
scale_nmr_color_diverging
,
scale_nmr_color_sequential
,
scale_nmr_color_categorical
Generate a sequential color scale with NMR colors
Generate a colour scale for nmr colors
scale_nmr_color_sequential( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... ) scale_nmr_colour_sequential( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
scale_nmr_color_sequential( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... ) scale_nmr_colour_sequential( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
discrete |
A boolean toggling whether the aesthetic is discrete |
interpolate |
A boolean toggling whether to interpolate colors |
reverse |
A boolean toggling whether to reverse the palette |
... |
Additional arguents to pass to 'colorRampPalette' |
A color scale for use in ggplot2 graphics.
scale_nmr_color_diverging
,
scale_nmr_color_orthogonal
,
scale_nmr_color_categorical
Generate a categorical fill scale with NMR colors
scale_nmr_fill_categorical( pal = "All", set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
scale_nmr_fill_categorical( pal = "All", set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
pal |
String to select palette type (e.g. for categorical, pairs or quads) |
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
discrete |
A boolean toggling whether the aesthetic is discrete |
interpolate |
A boolean toggling whether to interpolate colors |
reverse |
A boolean toggling whether to reverse the palette |
... |
Additional arguents to pass to 'colorRampPalette' |
A color scale for use in ggplot2 graphics.
scale_nmr_fill_diverging
,
scale_nmr_fill_sequential
,
scale_nmr_fill_orthogonal
Generate a diverging fill scale with NMR colors
scale_nmr_fill_diverging( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
scale_nmr_fill_diverging( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
discrete |
A boolean toggling whether the aesthetic is discrete |
interpolate |
A boolean toggling whether to interpolate colors |
reverse |
A boolean toggling whether to reverse the palette |
... |
Additional arguents to pass to 'colorRampPalette' |
A color scale for use in ggplot2 graphics.
scale_nmr_fill_sequential
,
scale_nmr_fill_orthogonal
,
scale_nmr_fill_categorical
Generate a orthogonal fill scale with NMR colors
scale_nmr_fill_orthogonal( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
scale_nmr_fill_orthogonal( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
discrete |
A boolean toggling whether the aesthetic is discrete |
interpolate |
A boolean toggling whether to interpolate colors |
reverse |
A boolean toggling whether to reverse the palette |
... |
Additional arguents to pass to 'colorRampPalette' |
A color scale for use in ggplot2 graphics.
scale_nmr_fill_diverging
,
scale_nmr_fill_sequential
,
scale_nmr_fill_categorical
Generate a sequential fill scale with NMR colors
scale_nmr_fill_sequential( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
scale_nmr_fill_sequential( set = "", index = NULL, pal_df = paletteNMR::nmrPalettes_2020, discrete = TRUE, interpolate = FALSE, reverse = FALSE, ... )
set |
String to select set of colors in palette (e.g. different variations or base colors) |
index |
A set of numerical values to subset palette |
pal_df |
List of dataframes containing color palettes, defaults to internal package data |
discrete |
A boolean toggling whether the aesthetic is discrete |
interpolate |
A boolean toggling whether to interpolate colors |
reverse |
A boolean toggling whether to reverse the palette |
... |
Additional arguents to pass to 'colorRampPalette' |
A color scale for use in ggplot2 graphics.
scale_nmr_fill_diverging
,
scale_nmr_fill_orthogonal
,
scale_nmr_fill_categorical
Theme with NMR color palette
theme_nmr(base_size = 11, base_family = "sans")
theme_nmr(base_size = 11, base_family = "sans")
base_size |
Numerical to set font sizes |
base_family |
String to set font family |
A ggplot2 theme theme_minimal