Sequential, diverging and qualitative colour scales from

The brewer scales provides sequential, diverging and qualitative colour schemes from ColorBrewer. These are particularly well suited to display discrete values on a map. See for more information.

scale_colour_brewer(..., type = "seq", palette = 1, direction = 1)
scale_fill_brewer(..., type = "seq", palette = 1, direction = 1)
scale_colour_distiller(..., type = "seq", palette = 1, direction = -1, values = NULL, space = "Lab", na.value = "grey50", guide = "colourbar")
scale_fill_distiller(..., type = "seq", palette = 1, direction = -1, values = NULL, space = "Lab", na.value = "grey50", guide = "colourbar")
Other arguments passed on to discrete_scale to control name, limits, breaks, labels and so forth.
One of seq (sequential), div (diverging) or qual (qualitative)
If a string, will use that named palette. If a number, will index into the list of palettes of appropriate type
Sets the order of colors in the scale. If 1, the default, colors are as output by brewer.pal. If -1, the order of colors is reversed.
if colours should not be evenly positioned along the gradient this vector gives the position (between 0 and 1) for each colour in the colours vector. See rescale for a convience function to map an arbitrary range to between 0 and 1.
colour space in which to calculate gradient. Must be "Lab" - other values are deprecated.
Colour to use for missing values
Type of legend. Use "colourbar" for continuous colour bar, or "legend" for discrete colour legend.

The brewer scales were carefully designed and tested on discrete data. They were not designed to be extended to continuous data, but results often look good. Your mileage may vary.


The distiller scales extends brewer to continuous scales by smoothly interpolate 6 colours from any palette to a continuous scale.


The following palettes are available for use with these scales:

See Also

Other colour scales: scale_alpha, scale_colour_gradient, scale_colour_grey, scale_colour_hue

  • scale_colour_brewer
  • scale_fill_brewer
  • scale_colour_distiller
  • scale_fill_distiller
  • scale_color_brewer
  • scale_color_distiller
library(ggplot2) dsamp <- diamonds[sample(nrow(diamonds), 1000), ] (d <- ggplot(dsamp, aes(carat, price)) + geom_point(aes(colour = clarity))) d + scale_colour_brewer() # Change scale label d + scale_colour_brewer("Diamond\nclarity") # Select brewer palette to use, see ?scales::brewer_pal for more details d + scale_colour_brewer(palette = "Greens") d + scale_colour_brewer(palette = "Set1") # scale_fill_brewer works just the same as # scale_colour_brewer but for fill colours p <- ggplot(diamonds, aes(x = price, fill = cut)) + geom_histogram(position = "dodge", binwidth = 1000) p + scale_fill_brewer() # the order of colour can be reversed p + scale_fill_brewer(direction = -1) # the brewer scales look better on a darker background p + scale_fill_brewer(direction = -1) + theme_dark() # Use distiller variant with continous data v <- ggplot(faithfuld) + geom_tile(aes(waiting, eruptions, fill = density)) v v + scale_fill_distiller() v + scale_fill_distiller(palette = "Spectral")
Documentation reproduced from package ggplot2, version 2.2.1, License: GPL-2 | file LICENSE

Community examples

Looks like there are no examples yet.