Awesome
<!-- README.md is generated from README.Rmd. Please edit that file -->severance <img src="man/figures/logo.png" align="right" height="300" />
The severance package contains color palettes for R inspired by the show Severance.
Images were sourced from the Apple TV+ Press website. The structure of the package was based on the MetBrewer package by Blake R. Mills and the wesanderson package by Karthik Ram.
Installation
You can install the development version of severance from GitHub with:
# install.packages("devtools")
devtools::install_github("ivelasq/severance")
Examples
Here are examples of the severange package using TidyTuesday data from the Bureau of Labor Statistics. The plot is based on one created by Amanda Luby from the Swarthmore College Data Visualization Group.
<img src="man/figures/README-plot-ref-1.png" title="Three steamplots showing the gender disparity between races displayed in three different palettes from the severance package" alt="Three steamplots showing the gender disparity between races displayed in three different palettes from the severance package" width="100%" />The code to reproduce the plot is below:
library(severance)
library(ggplot2)
library(cowplot)
library(dplyr)
library(tidyr)
earn <-
readr::read_csv(
'https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-23/earn.csv'
)
earn_clean <- earn %>%
mutate(median_yearly = median_weekly_earn * 52) %>%
filter(race != "All Races",
sex != "Both Sexes") %>%
group_by(race, sex, year, quarter) %>%
summarize(median_salary = median(median_yearly)) %>%
pivot_wider(
id_cols = c("race", "year", "quarter"),
names_from = sex,
values_from = median_salary
) %>%
group_by(race) %>%
mutate(
time = paste(year, quarter, sep = "-Q"),
men_dev = Men - (Men + Women) / 2,
women_dev = Women - (Men + Women) / 2,
race = factor(race, levels = c(
"Asian", "White", "Black or African American"
))
)
p <-
ggplot(earn_clean,
aes(
x = time,
ymin = women_dev,
ymax = men_dev,
fill = race,
group = race
)) +
geom_ribbon() +
theme_void() +
theme(legend.position = "none")
p1 <- p + scale_fill_manual(values = severance_palette("Jazz02"))
p2 <- p + scale_fill_manual(values = severance_palette("TheYouYouAre"))
p3 <- p + scale_fill_manual(values = severance_palette("Hell"))
title <- ggdraw() +
draw_label(
"Original visualization by Amanda Luby, Swarthmore College",
fontface = "bold",
x = 0,
hjust = 0
) +
theme(plot.margin = margin(0, 0, 0, 7))
prow <- plot_grid(
p1,
p2,
p3,
align = 'h',
labels = c("Jazz02", "TheYouYouAre", "Hell"),
hjust = 0,
nrow = 1
)
caption <- ggdraw() +
draw_label("Source: BLS Earnings Data",
hjust = -0.3,
vjust = -0.5)
plot_grid(title,
prow,
caption,
ncol = 1,
# rel_heights values control vertical title margins
rel_heights = c(0.3, 1))
Palettes
Colorblind-friendly
Dinner
<img src="man/figures/dinner_cbf.jpg" alt="A scene from Severance where Helly and Dylan are standing in a room">Hell
<img src="man/figures/hell_cbf.jpg" alt="A scene from Severance where Helly is sitting on the floor">Jazz02
<img src="man/figures/jazz02_cbf.jpg" alt="A scene from Severance where the four main characters are staring at something">TheYouYouAre
<img src="man/figures/theyouyouare_cbf.jpg" alt="A scene from Severance where Helly sits in a chair">Not colorblind-friendly
Half
<img src="man/figures/half_ncbf.jpg" alt="A scene from Severance where a bunch of characters are talking at their desks">HideAndSeek
<img src="man/figures/hideandseek_ncbf.jpg" alt="A scene from Severance where a bunch of characters look at Milchick">Jazz01
<img src="man/figures/jazz01_ncbf.jpg" alt="A scene from Severance where Helly and Milchick dance">Notes
Thank you to the package developers of MetBrewer package, Blake R. Mills, and the wesanderson package, Karthik Ram, for sharing their code.
Thank you to Amanda Luby from the Swarthmore College Data Visualization Group for sharing her data visualization.
Colorblind-friendliness was checked using the Adobe Color Accessibility Wheel.
Please reach out with any questions/comments/suggestions! If you have a palette to contribute, please file a Pull Request.