A function that returns a color palette function based off of the viridis package.

viridis_magma_palette(viridis_number = 800,
  viridis_range = 300:viridis_number, viridis_rev = TRUE,
  magma_number = 500, magma_range = 50:magma_number,
  magma_rev = FALSE, ...)

Arguments

viridis_number

The total number of colors used to generate the viridis palette. Default: 800

viridis_range

Tne range of colors in the viridis palette to use. Default: 300:viridis_number

viridis_rev

A logical for reversing the viridis palette. Default: TRUE

magma_number

The total number of colors used to generate the magma palette. Default: 500

magma_range

The range of colors in the magma palette to use. Default: 0:magma_number

magma_rev

A logical for reversing the magma palette. Default: FALSE

...

These dots are optionally used as both the magma and viridis function parameters.

Value

The output of this function is another function (grDevoces::colorRampPalette), which takes a number to generate an interpolated color palette as a character vector.

Details

The primary purpose of this function is to return a palette-function for generating virdis style color palettes. By taking the viridis::viridis() and the viridis::magma() colors, and manipulating them, this function can help create a unique set of colors that you can distinguish on a busy plot. The hopes of this function is to help improve plots that use more than 20 colors. Use the provided example to view the color palette.

See also

Examples

# NOT RUN {
if(interactive()){
 # Use the default values
 > pal_func <- viridis_palette()

 # Get a palette with 20 colors
 > pal <- pal_func(20)

 # Make a pie plot of the colros.
 > pie(rep(1, length(pal)), col=pal)
 }
# }