Learn R Programming

ggsketch (version 2.0.0)

sketch_palette: The ggsketch qualitative colour palette

Description

Eight muted ink-on-paper colours led by the package primary (Carolina blue, #7BAFD4), ordered for maximal separation.

Usage

sketch_palette(n = NULL, interpolate = TRUE)

Value

A character vector of hex colours.

Arguments

n

Number of colours to return. If NULL, the eight anchor colours are returned. Up to eight are taken verbatim; beyond that they are interpolated (or recycled, if interpolate = FALSE).

interpolate

When n > 8, interpolate the eight anchors into n colours (the default). FALSE recycles the anchors with a warning.

Details

The first eight colours are returned exactly, so small categorical plots keep their recognisable hues. Ask for more than eight and the palette is interpolated: a smooth colorRampPalette() ramp through all eight anchors yields n distinct ink tones, so the discrete sketch scales keep working for large factors and for quasi-continuous use. Set interpolate = FALSE to fall back to the old recycling behaviour instead.

See Also

Other sketch-theme: CoordSketch, CoordSketchPolar, element_sketch_line(), ggsketch_check_fonts(), ggsketch_save(), register_sketch_font(), scale_pressure_continuous(), scale_roughness_continuous(), scale_sketch, scale_tone_continuous(), theme_sketch()

Examples

Run this code
sketch_palette(4)
sketch_palette(20)             # interpolated ramp through all eight anchors

Run the code above in your browser using DataLab