Examples

library(tvthemes)
library(ggplot2)
library(gapminder)
library(scales)
library(glue)
library(png)
library(dplyr)
library(cowplot)
library(extrafont)
loadfonts(quiet = TRUE)

Examples

Code for all the examples shown in the README.

Brooklyn Nine-Nine

b99d

b99d

b99l

b99l

Spongebob Squarepants

bobspog

bobspog

bobspogbkg

bobspogbkg

Game of Thrones: House Stark, Tully, Targaryen

StarkTullyTargaryen

StarkTullyTargaryen

Game of Thrones: House Tyrell, Lannister, Greyjoy

data <- gapminder::gapminder %>% 
  filter(country %in% c("France", "Germany", "Ireland", "Italy", "Japan", "Norway", "Belarus")) %>% 
  mutate(year = as.Date(paste(year, "-01-01", sep = "", format = '%Y-%b-%d')))

ggplot(data = data, aes(x = year, y = gdpPercap, fill = country)) +
  geom_area(alpha = 0.8) +
  scale_x_date(breaks = data$year, date_labels = "%Y") +
  scale_y_continuous(expand = c(0, 0), labels = scales::dollar) +
  scale_fill_westeros(palette = "Tyrell") +
  labs(title = "All men are fools, if truth be told, but",
       subtitle = "the ones in motley are more amusing than ones with crowns.",
       caption = "- The Queen of Thorns") +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 10),
        plot.title = element_text(family = "Cinzel", size = 16),
        plot.subtitle = element_text(family = "Cinzel", size = 12)) -> tyrell

ggplot(diamonds, aes(price, fill = cut)) +
  geom_histogram(binwidth = 500) +
  labs(title = "You are done with whores.",
       subtitle = "The next one I find in your bed, I'll hang.",
       caption = "Rains of Castamere") +
  scale_fill_westeros(palette = "Lannister", n = 5, reverse = TRUE) +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 14)) -> lannister

airquality %>% 
  mutate(Month = as.factor(Month)) %>% 
  ggplot(aes(x = Day, y = Temp, group = Month, color = Month)) +
  geom_line(size = 1.5) +
  scale_color_westeros(palette = "Greyjoy") +
  labs(title = "I am the storm, my lord.",
       subtitle = "The first storm, and the last.",
       caption = "- Euron 'The Crow's Eye' Greyjoy") +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 10),
        title = element_text(family = "Cinzel", size = 14)) -> greyjoy

## patchwork together:
tyrell + lannister - greyjoy + plot_layout(ncol = 1)
TyrellLannisterGreyjoy

TyrellLannisterGreyjoy

Game of Thrones: Arryn, Manderly, Martell

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  scale_fill_westeros(palette = "Arryn", n = 7) +
  labs(title = "The Seed is Strong.",
       subtitle = "The bad little man. Mother, can I make him fly?",
       caption = "I want to see him fly.") +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 14),
        plot.title = element_text(family = "Cinzel", size = 18),
        legend.position = "none") -> arryn

airquality %>% 
  mutate(Month = as.factor(Month)) %>% 
  ggplot(aes(x = Day, y = Temp, group = Month, color = Month)) +
  geom_line(size = 1.5) +
  scale_color_westeros(palette = "Manderly", n = 6) +
  labs(title = "The North remembers Lord Davos. The North remembers...",
       subtitle = "The mummer's farce is almost done, my son is coming home.",
       caption = "When treating with liars, even an honest man must lie.") +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 12),
        plot.title = element_text(family = "Cinzel", size = 14),
        legend.position = "none") -> manderly

data <- gapminder::gapminder %>% 
  filter(country %in% c("France", "Germany", "Ireland", "Italy", "Japan", "Norway", "Belarus", "Canada", "Mexico")) %>% 
  mutate(year = as.Date(paste(year, "-01-01", sep = "", format = '%Y-%b-%d')))

ggplot(data = data, aes(x = year, y = gdpPercap, fill = country)) +
  geom_area(alpha = 0.8) +
  scale_x_date(expand = c(0, 0),
               breaks = data$year, date_labels = "%Y") +
  scale_y_continuous(expand = c(0, 0), labels = scales::dollar) +
  scale_fill_westeros(palette = "Martell", n = 8) +
  labs(title = "What is our heart's desire? - Ariane Martell",
       subtitle = "Vengeance. Justice. Fire And Blood. - Doran Martell",
       caption = "Hiss with me Sand Snakes, HISSS!") +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 10),
        plot.title = element_text(family = "Cinzel", size = 24),
        plot.subtitle = element_text(family = "Cinzel", size = 26),
        legend.position = "none") -> martell

## patchwork together:
arryn + manderly - martell + plot_layout(ncol = 1)
ArrynManderlyMartell

ArrynManderlyMartell

Game of Thrones: Stannis Baratheon, The One True King

stannis

stannis

The Simpsons

simpsons

simpsons

Rick and Morty

randm

randm

Avatar: The Last Airbender (Fire Nation, Air Nomads, Water Tribe, Earth Kingdom)

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  scale_fill_avatar(palette = "FireNation") +
  labs(title = "Flameo, Hotman!",
       subtitle = "Fire. Wang Fire. This is my wife, Sapphire.",
       x = "Lion Vultures Owned",
       y = "Agni Kai Participation") +
  theme_avatar(title.font = "Slayer",
               text.font = "Slayer") -> firenation

airquality %>% 
  mutate(Month = as.factor(Month)) %>% 
  ggplot(aes(x = Day, y = Temp, group = Month, color = Month)) +
  geom_line(size = 1.5) +
  scale_color_avatar(palette = "AirNomads") +
  labs(title = "Let's head to the Eastern Air Temple!",
       subtitle = "Appa, Yip Yip!") +
  theme_avatar(title.font = "Slayer",
               text.font = "Slayer",
               title.size = 10) -> airnomads

ggplot(gapminder::gapminder,
       aes(x = log10(gdpPercap), y = lifeExp)) +
  geom_point(aes(color = continent)) + 
  scale_x_log10() +
  scale_color_avatar(palette = "WaterTribe") +
  labs(title = "I am thinking maybe we could... do an activity together?",
       subtitle = "... Do an activity?",
       x = "GDP per Otter-Penguins",
       y = "Life Expectancy of Arctic Camels") +
  theme_avatar(title.font = "Slayer",
               text.font = "Slayer",
               title.size = 8,
               subtitle.size = 8) -> watertribe

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  scale_fill_avatar(palette = "EarthKingdom") +
  labs(title = "There is no war in Ba Sing Se",
       subtitle = "(Welcome to Lake Laogai)") +
  theme_avatar(title.font = "Slayer",
               text.font = "Slayer",
               title.size = 14) -> earthkingdom

## plot together:
plot_grid(firenation, airnomads, watertribe, earthkingdom, ncol = 2)
tla

tla

Parks and Recreation

pandr

pandr

Attack on Titan

aot

aot

Kim Possible

KimPossible

KimPossible

Big Hero 6

bighero6

bighero6

Hilda

airquality %>% 
  mutate(Month = as.factor(Month)) %>% 
  ggplot(aes(x = Day, y = Temp, group = Month, color = Month)) +
  geom_line(size = 1.5) +
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0)) +
  scale_color_hilda(palette = "Day") +
  labs(title = "Well, that was pretty traumatic...",
       subtitle = "but such is the life of an adventurer!",
       caption = "I don't even have hands!!") +
    theme_hildaDay(ticks = TRUE,
                    legend.position = "none") -> hildaday

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = rev(class)), col = "black", size = 0.1) +
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0)) +
  scale_fill_hilda(palette = "Dusk", reverse = TRUE) +
  labs(title = stringr::str_wrap("If you ask me all houses are basically the same. Roof, floors, walls...", width = 50),
       subtitle = "people saying STOP WALKING IN LIKE THAT WOODMAN!",
       caption = "I'm more of a writer than a fighter!") +
    theme_hildaDusk(ticks = TRUE,
                    legend.position = "none") -> hildadusk

airquality %>% 
  mutate(Month = as.factor(Month)) %>% 
  ggplot(aes(x = Day, y = Temp, group = Month, fill = Month)) +
  geom_point(size = 3, stroke = 1.25, shape = 21) +
  labs(title = "Could someone close that door,", 
       subtitle = "it's a little drafty in here...",
       caption = "I'm quite tall for an elf, actually.") + 
  scale_fill_hilda(palette = "Night", reverse = TRUE) +
  scale_x_continuous(expand = c(0.05, 0.02)) +
  scale_y_continuous(expand = c(0.05, 0.02)) +
  theme_hildaNight(ticks = TRUE) -> hildanight

plot_grid(hildaday, hildadusk, hildanight, ncol = 2)
hilda

hilda

Gravity Falls

gravityfall

gravityfall