Skip to contents

Discrete fill and colour scales that emphasize a single category level and fade all others to grey. Useful for drawing attention to one group in a plot while de-emphasizing the rest.

Usage

scale_fill_highlight(highlight, color = "#3B0A45", fade = "#cccccc", ...)

scale_colour_highlight(highlight, color = "#3B0A45", fade = "#cccccc", ...)

scale_color_highlight(highlight, color = "#3B0A45", fade = "#cccccc", ...)

Arguments

highlight

Character. The name of the category level to highlight.

color

Character. The highlight color. Default is "#3B0A45" (solaris purple).

fade

Character. The color for non-highlighted levels. Default is "#cccccc" (light grey).

...

Additional arguments passed to discrete_scale.

Value

A ggplot2 scale object.

Details

The highlight level receives color (default solaris purple, "#3B0A45") while all other levels receive fade (default light grey, "#cccccc").

Examples

if (FALSE) { # \dontrun{
library(ggplot2)

ggplot(mtcars, aes(factor(cyl), fill = factor(cyl))) +
  geom_bar() +
  scale_fill_highlight(highlight = "4")

ggplot(mtcars, aes(wt, mpg, colour = factor(cyl))) +
  geom_point(size = 3) +
  scale_colour_highlight(highlight = "6", color = "#FFD700")
} # }