Learn R Programming

ggsketch (version 2.0.0)

scale_sketch: Sketch colour and fill scales

Description

Discrete scales (scale_colour_sketch(), scale_fill_sketch()) use sketch_palette(); the continuous variants (*_sketch_c()) use a paper-to-ink blue gradient. They pair with theme_sketch() and the sketch geoms but work with any ggplot2 layer.

Usage

scale_colour_sketch(..., aesthetics = "colour", interpolate = TRUE)

scale_color_sketch(..., aesthetics = "colour", interpolate = TRUE)

scale_fill_sketch(..., aesthetics = "fill", interpolate = TRUE)

scale_colour_sketch_c(..., aesthetics = "colour")

scale_color_sketch_c(..., aesthetics = "colour")

scale_fill_sketch_c(..., aesthetics = "fill")

Value

A ggplot2 scale object.

Arguments

...

Passed to ggplot2::discrete_scale() (discrete) or ggplot2::scale_colour_gradientn() (continuous).

aesthetics

Character vector of aesthetics this scale works with.

interpolate

Discrete scales only. When there are more than eight levels, interpolate the eight-colour sketch_palette() into one colour per level (the default) instead of recycling.

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_tone_continuous(), sketch_palette(), theme_sketch()

Examples

Run this code
library(ggplot2)
ggplot(mpg, aes(displ, hwy, colour = drv)) +
  geom_sketch_point(seed = 1L) +
  scale_colour_sketch() +
  theme_sketch()

Run the code above in your browser using DataLab