Title: | Color Palettes using Colormaps Node Module |
---|---|
Description: | Allows to generate colors from palettes defined in the colormap module of 'Node.js'. (see <https://github.com/bpostlethwaite/colormap> for more information). In total it provides 44 distinct palettes made from sequential and/or diverging colors. In addition to the pre defined palettes you can also specify your own set of colors. There are also scale functions that can be used with 'ggplot2'. |
Authors: | Bhaskar Karambelkar [aut, cre] |
Maintainer: | Bhaskar Karambelkar <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.9000 |
Built: | 2024-11-02 02:56:14 UTC |
Source: | https://github.com/bhaskarvk/colormap |
A package to generate colors from a list of 44 pre-defined palettes
Generate colors from a list of 44 palettes
colormap(colormap = colormaps$viridis, nshades = 72, format = "hex", alpha = 1, reverse = FALSE)
colormap(colormap = colormaps$viridis, nshades = 72, format = "hex", alpha = 1, reverse = FALSE)
colormap |
A string, vector of hex color codes, or a list.
Use the |
nshades |
A number. Number of colors to generate. |
format |
A string. Should be 'hex', 'rgb', or 'rgbaString' |
alpha |
A Number between 0 and 1 |
reverse |
Boolean. Whether to reverse the order. |
Colors either in vector, matrix, list format depending on format.
Bhaskar V. Karambelkar
colormap() # Defaults to 72 colors from the 'viridis' palette. colormap(colormap=colormaps$temperature, nshades=20) # Diff Palette colormap(colormap=c('#000000','#FF0000'), nshades=20) # Colormap as vector of colors # list of list. Maximum flexibility colormap(colormap=list(list(index=0,rgb=c(0,0,0)),list(index=1,rgb=c(255,255,255))), nshades=10) colormap(format='rgb',nshades=10) # As rgb colormap(format='rgb',nshades=10,alpha=0.5) # Constant alpha colormap(format='rgbaString',nshades=10) # As rgba string
colormap() # Defaults to 72 colors from the 'viridis' palette. colormap(colormap=colormaps$temperature, nshades=20) # Diff Palette colormap(colormap=c('#000000','#FF0000'), nshades=20) # Colormap as vector of colors # list of list. Maximum flexibility colormap(colormap=list(list(index=0,rgb=c(0,0,0)),list(index=1,rgb=c(255,255,255))), nshades=10) colormap(format='rgb',nshades=10) # As rgb colormap(format='rgb',nshades=10,alpha=0.5) # Constant alpha colormap(format='rgbaString',nshades=10) # As rgba string
Create a Palette generating function
colormap_pal(alpha = 1, colormap = colormaps$viridis, reverse = FALSE)
colormap_pal(alpha = 1, colormap = colormaps$viridis, reverse = FALSE)
alpha |
pass through parameter to |
colormap |
pass through parameter to |
reverse |
pass through parameter to |
A function that can generate colors from a specified colormap.
scales::show_col(colormap_pal()(10)) scales::show_col(colormap_pal(colormap=colormaps$viridis)(100), labels=FALSE)
scales::show_col(colormap_pal()(10)) scales::show_col(colormap_pal(colormap=colormaps$viridis)(100), labels=FALSE)
List of pre-defined colormaps
colormaps
colormaps
An object of class list
of length 44.
Uses the colormap color scale
scale_color_colormap(..., alpha = 1, colormap = colormaps$viridis, discrete = FALSE, reverse = FALSE) scale_fill_colormap(..., alpha = 1, colormap = colormaps$viridis, discrete = FALSE, reverse = FALSE)
scale_color_colormap(..., alpha = 1, colormap = colormaps$viridis, discrete = FALSE, reverse = FALSE) scale_fill_colormap(..., alpha = 1, colormap = colormaps$viridis, discrete = FALSE, reverse = FALSE)
... |
parameters to |
alpha |
pass through parameter to |
colormap |
pass through parameter to |
discrete |
generate a discrete palette? (default: |
reverse |
pass through parameter to |
For discrete == FALSE
(the default) all other arguments are as to
scale_fill_gradientn or scale_color_gradientn.
Otherwise the function will return a discrete_scale
with the plot-computed
number of colors.
See colormap for more information on the color scale.