View source: R/ggplot-scales.R
scale_color_collection | R Documentation |
Generic color scale from any palette collection
scale_color_collection(collection, palette, discrete = TRUE, ...)
scale_fill_collection(collection, palette, discrete = TRUE, ...)
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' |
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.