knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Set Up

library(ProvidenceThemes)
library(ggplot2)
# make fake data for plots ----
points <- data.frame(x = 1:10, y = 1:10)
distrb <- data.frame(x = rep(1:6, 10), y = rnorm(60, 0, 1))

# make plots for themes ----
g_points <- ggplot(points, aes(x, y, col = factor(x))) + geom_point(size = 5)
g_distrb <- ggplot(distrb, aes(y, fill = factor(x))) + geom_density() + facet_wrap(. ~ x, ncol = 3)
g_points_cont <- ggplot(points, aes(x, y, col = x)) + geom_point(size = 5)

Motivation for this Theme

ADD SOMETHING HERE!

Key Colors

The colors in the discrete palette are:

scales::show_col(providence_pal)

The colors used to define the continuous palette spectrum are:

scales::show_col(providence_pal_cont)

The colors used in the diverging palette are:

scales::show_col(providence_pal_div)

Discrete Palettes

Consider the following plots:

g_points
g_distrb

Fixed-length discrete palettes use the palette's selected colors until they run out, then it uses grey for all additional levels of the aesthetic.

g_points + scale_color_discrete_providence(palette = "providence")
g_distrb +  scale_fill_discrete_providence(palette = "providence")

Interpolated palettes extend the discrete palette by interpolating additional values.

g_points + scale_color_discrete_providence(palette = "providence", extend = TRUE)
g_distrb + scale_fill_discrete_providence(palette = "providence", extend = TRUE)

Opinionated palettes color specific values for "good", "bad", and "neutral" in your dataset.

points$assessment <- "neutral"
points$assessment[points$x > 5] <- "good"
points$assessment[points$x < 3] <- "bad"

ggplot(points, aes(x, y, col = assessment)) + geom_point() + scale_color_opinionated_providence(palette = "providence")

Continuous Palettes

Consider the following plots:

g_points_cont

Diverging palettes grow more extreme at the endpoints. You can specify the midpoint of where the center should be.

g_points_cont + scale_color_diverging_providence(palette = "providence", midpoint = 5)

Normal continuous scales gradually move between two ends of a spectrum.

g_points_cont + scale_color_continuous_providence(palette = "providence")


RollieParrish/ProvidenceThemes documentation built on Feb. 15, 2021, 7:54 p.m.