gg_color_gradient: Generate a continuous color gradient to be colored via...

View source: R/gg_color_swatches.R

gg_color_gradientR Documentation

Generate a continuous color gradient to be colored via ggplot2's scale_fill_* mechanism

Description

This function creates a ggplot2 object that can be directly styled by adding a scale_fill_* expression. Thus, this function is particularly useful to visualize existing ggplot2 color scales.

Usage

gg_color_gradient(n = 200, ymargin = 0, title = NULL,
  title_size = 14, title_family = "", title_face = "plain",
  plot_margin = margin(title_size/2, title_size/2, title_size/2,
  title_size/2))

Arguments

n

Number of distinct color slices to be drawn

ymargin

Fraction of each swatch to be used as margin in the y direction

title

Optional title to print above the color swatches. Can also be provided via ggtitle.

title_size

Font size of the title

title_family

Font family of the title

title_face

Font face of the title

plot_margin

Margin around the plot, specified via the ggplot2 function margin

Examples

gg_color_gradient() + ggtitle("Default ggplot2 continuous color scale")

clauswilke/colorblindr documentation built on July 29, 2023, 2:17 p.m.