Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

scale_color_tableau

Tableau color scales (discrete)


Description

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 Tableu.

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.

type

Palette type. One of "regular", "sequential", or "diverging". See tableau_color_pal().

direction

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

...

Other arguments passed on to discrete_scale().

See Also

tableau_color_pal() for references.

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)

ggthemes

Extra Themes, Scales and Geoms for 'ggplot2'

v4.2.4
GPL-2
Authors
Jeffrey B. Arnold [aut, cre] (<https://orcid.org/0000-0001-9953-3904>), Gergely Daroczi [ctb], Bo Werth [ctb], Brian Weitzner [ctb], Joshua Kunst [ctb], Baptise Auguie [ctb], Bob Rudis [ctb], Hadley Wickham [ctb] (Code from the ggplot2 package.), Justin Talbot [ctb] (Code from the labeling package), Joshua London [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.