scale_color_collection: Generic color scale from any palette collection

View source: R/ggplot-scales.R

scale_color_collectionR Documentation

Generic color scale from any palette collection

Description

Generic color scale from any palette collection

Usage

scale_color_collection(collection, palette, discrete = TRUE, ...)

scale_fill_collection(collection, palette, discrete = TRUE, ...)

Arguments

collection

Name of palette collection (e.g. "sb", "ohsu")

palette

Name of palette in that collection

discrete

Logical: use discrete scale?

...

Other arguments passed to 'scale_*_manual' or 'scale_*_gradientn'

Examples

library(ggplot2)
library(palmerpenguins)

ggplot(data = penguins,
       aes(x = flipper_length_mm,
           y = body_mass_g)) +
  geom_point(aes(color = species,
                 shape = species),
             size = 2) +
  theme_minimal() +
  laviz::scale_color_collection(collection = "personal",
                                palette = "sb_colorblind")

ggplot(data = penguins,
       aes(x = flipper_length_mm,
           y = body_mass_g)) +
  geom_point(aes(color = species,
                 shape = species),
             size = 2) +
  theme_minimal() +
  laviz::scale_color_collection(collection = "personal",
                                palette = "carter3a")

ggplot(penguins,
       aes(x = flipper_length_mm,
           y = body_mass_g)) +
  geom_point(aes(color = sex)) +
  theme_minimal() +
  laviz::scale_color_collection(collection = "personal",
                                palette = "binary") +
  facet_wrap(~ species)
library(ggplot2)
library(palmerpenguins)

ggplot(penguins,
       aes(x = island,
           fill = species)) +
  geom_bar(alpha = 0.8) +
  theme_minimal() +
  facet_wrap(~species, ncol = 1) +
  coord_flip() +
  laviz::scale_fill_collection(collection = "sb",
                               palette = "deep")


ggplot(data = penguins,
       aes(x = flipper_length_mm)) +
  geom_histogram(aes(fill = species),
                 alpha = 0.5,
                 position = "identity",
                 color = "white",
                 binwidth = 2) +
  theme_minimal() +
  laviz::scale_fill_collection(collection = "personal",
                               palette = "morosco3")


emilelatour/laviz documentation built on June 13, 2025, 9:41 a.m.