ivelasq / severance

The severance package contains color palettes inspired by the show Severance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

severance

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.

Three steamplots showing the gender disparity between races displayed in three different palettes from the severance package

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

A scene from Severance where Helly and Dylan are standing in a room

Hell

A scene from Severance where Helly is sitting on the floor

Jazz02

A scene from Severance where the four main characters are staring at something

TheYouYouAre

A scene from Severance where Helly sits in a chair

Not colorblind-friendly


Half

A scene from Severance where a bunch of characters are talking at their desks

HideAndSeek

A scene from Severance where a bunch of characters look at Milchick

Jazz01

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.

About

The severance package contains color palettes inspired by the show Severance

License:Other


Languages

Language:R 100.0%