Skip to contents

Categorical (qualitative) color scales used in Tableau. Use the function scale_colour_gradient_tableau() for the sequential and scale_colour_gradient2_tableau() for the diverging continuous color scales from Tableau.

Usage

scale_colour_tableau(
  palette = "Tableau 10",
  ...,
  type = "regular",
  direction = 1
)

scale_fill_tableau(
  palette = "Tableau 10",
  ...,
  type = "regular",
  direction = 1
)

scale_color_tableau(
  palette = "Tableau 10",
  ...,
  type = "regular",
  direction = 1
)

Arguments

palette

Palette name. See tableau_color_pal() for available palettes.

...

Other arguments passed on to ggplot2::discrete_scale().

type

The type of palette, one of:

  • "regular", the default: discrete, qualitative palettes.

  • "ordered-sequential": sequential palettes.

  • "ordered-diverging": diverging palettes.

direction

If 1 (the default), use the original order of colors. If -1, reverse the order.

Value

A ggplot2 scale object.

Examples

library("ggplot2")

p <- ggplot(mtcars) +
  geom_point(aes(x = wt, y = mpg, colour = factor(gear))) +
  facet_wrap(~am) +
  theme_igray()

palettes <- ggthemes_data[["tableau"]][["color-palettes"]][["regular"]]
for (palette in head(names(palettes), 3L)) {
  print(p + scale_colour_tableau(palette) + ggtitle(palette))
}




# the order of colour can be reversed
p + scale_color_tableau(direction = -1)