Check and manipulate colors
edma_colors.RdCheck and manipulate the default color values.
Usage
edma_colors(n,
type=c("diverging", "sequential", "qualitative"),
alpha=1, rev=FALSE)
plot_edma_colors(n=9, maxq=9)Arguments
- n
the number of colors (>0) to be in the palette.
- type
the type of palette.
- alpha
the alpha transparency, a number in [0,1].
- rev
logical, should colors be reversed.
- maxq
maximum number of qualitative colors to plot.
Details
edma_colors create a vector of n colors
based on the settings in getOption("edma_options").
The options can be set via options (see Examples).
The options can either be the name of a palette hcl.colors.
When the option is set to multiple values, those are treated
as colors to be interplolated with colorRampPalette.
For qualitative palettes, the color values are used directly
(recycled as needed).
Sequential palettes are produced as the higher half of the diverging palette for consistency.
Value
edma_colors returns a vector of hax color codes,
plot_edma_colors produces a plot with the
diverging, sequential, and qualitative default palettes
given settings in getOption("edma_options").
Examples
## default palettes
plot_edma_colors(101)
## change default palettes
op <- options("edma_options" = list(
diverging = "Green-Orange",
qualitative = "Dark 2"))
plot_edma_colors(101)
## use color names
options("edma_options" = list(
diverging = c("black", "grey", "pink"),
qualitative = "Warm"))
plot_edma_colors(101)
## reset defaults
options(op)
plot_edma_colors(101)