1 😄加载经常用的R包😄

library(pacman)
# 读数据
p_load(readxl,writexl,data.table,openxlsx,haven,rvest)
# 数据探索
p_load(tidyverse,DT,skimr,DataExplorer,explore,vtable,stringr,kableExtra,lubridate)
# 模型
p_load(grf,glmnet,caret,tidytext,fpp2,forecast,car,tseries,hdm,tidymodels,broom)
# 可视化
p_load(patchwork,ggrepel,ggcorrplot,gghighlight,ggthemes,shiny)
# 其它常用包
p_load(magrittr,listviewer,devtools,here,janitor,reticulate,jsonlite)

2 😄安装tvthemes😄

p_load(tvthemes,scales)

Current list of TV shows:

  • Avatar: The Last Airbender: theme + palettes (Fire Nation, Water Tribe, Earth Kingdom, & Air Nomads)
  • Brooklyn Nine-Nine: theme + palettes (regular & dark)
  • Game of Thrones/A Song of Ice & Fire: ‘The Palettes of Ice & Fire’ (currently: Stark, Baratheon (Stannis), Lannister, Tully, Targaryen, Martell, Greyjoy, Tyrell, Arryn, Manderly)
  • Rick & Morty: theme + palette
  • Parks & Recreation: two themes (light & dark) + palette
  • The Simpsons: theme + palette
  • Spongebob Squarepants: theme + palette + background images
  • Hilda: Day, Dusk, Night themes + palettes
  • Attack on Titan: palette
  • Kim Possible: palette
  • Big Hero 6: palette
  • Gravity Falls: palette
  • More in future releases…
  • Development branch: TBD…

3 😄tvthemes 1.0.0 Major Changes😄

tvthemes:::westeros_palette$Lannister %>% scales::show_col()

tvthemes:::brooklyn99_palette$Dark %>% scales::show_col()

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  mytheme
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1)  +
  tvthemes::scale_fill_westeros(palette = "Stannis", n = 7, reverse = TRUE)

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  scale_fill_kimPossible(n = 5, reverse = FALSE) 
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  scale_fill_kimPossible(n = 5, reverse = FALSE) +
  theme_hildaDay(ticks = TRUE)

4 😄Fonts & Colors😄

library(tvthemes)

import_simpsons()         ## "Akbar" font
## You should install these fonts on your system directly. The files are located in [D:/keyanruanjian/R/R/library/tvthemes/fonts/Simpsons-Font]
import_avatar()           ## "Slayer" font (formerly `theme_theLastAirbender()`)
## You should install these fonts on your system directly. The files are located in [D:/keyanruanjian/R/R/library/tvthemes/fonts/Slayer]
import_rickAndMorty()     ## "Get Schwifty" font
## You should install these fonts on your system directly. The files are located in [D:/keyanruanjian/R/R/library/tvthemes/fonts/Rick-And-Morty]
import_robotoCondensed()  ## "Roboto Condensed" Google Font import from hrbrthemes
## You will likely need to install these fonts on your system as well.
## 
## You can find them in [D:/keyanruanjian/R/R/library/tvthemes/fonts/Roboto-Condensed]
import_titilliumWeb()     ## "Titillium Web" Google Font import from hrbrthemes
## You should install these fonts on your system directly. The files are located in [D:/keyanruanjian/R/R/library/tvthemes/fonts/Titillium-Web]
import_spongeBob()        ## "Some Time Later" font
## You should install these fonts on your system directly. The files are located in [D:/keyanruanjian/R/R/library/tvthemes/fonts/SpongeBob]
import_cinzel()           ## "Cinzel" font to use with 'The Palettes of Ice & Fire'
## You will likely need to install these fonts on your system as well.
## 
## You can find them in [D:/keyanruanjian/R/R/library/tvthemes/fonts/Cinzel]
import_chelseaMarket()    ## "Chelsea Market" font for "Hilda"
## You should install these fonts on your system directly. The files are located in [D:/keyanruanjian/R/R/library/tvthemes/fonts/ChelseaMarket]
import_gravitationFalls() ## "Gravitation Falls" font for "Gravity Falls"
## You should install these fonts on your system directly. The files are located in [D:/keyanruanjian/R/R/library/tvthemes/fonts/GravitationFalls]
tvthemes:::bigHero6_palette %>% show_col()

tvthemes:::attackOnTitan_palette %>% show_col()

tvthemes:::brooklyn99_palette$Regular %>% show_col()

5 😄Examples😄

5.1 💐Brooklyn Nine-Nine💐

library(glue)
## 
## Attaching package: 'glue'
## The following object is masked from 'package:dplyr':
## 
##     collapse
mpg %>% 
  ggplot(aes(displ)) +
  geom_histogram(aes(fill = class),
                 col = "black", size = 0.1,
                 binwidth = 0.1) +
  labs(title = "Do you know what it means to 'clap back', Raymond?",
       subtitle = glue("BE- {emo::ji('clap')} -CAUSE {emo::ji('clap')} I {emo::ji('clap')} DO {emo::ji('clap')} !"),
       x = "Titles of Your Sex Tape",
       caption = "Pizza bagels? Pizza rolls? Pizza poppers? Pizzaritos? Pizza pockets?") +
  mytheme -> p1
mpg %>% 
  ggplot(aes(displ)) +
  geom_histogram(aes(fill = class),
                 col = "black", size = 0.1,
                 binwidth = 0.1) +
  labs(title = "Do you know what it means to 'clap back', Raymond?",
       subtitle = glue("BE- {emo::ji('clap')} -CAUSE {emo::ji('clap')} I {emo::ji('clap')} DO {emo::ji('clap')} !"),
       x = "Titles of Your Sex Tape",
       caption = "Pizza bagels? Pizza rolls? Pizza poppers? Pizzaritos? Pizza pockets?") +
  scale_fill_brooklyn99(palette = "Dark") +
  theme_brooklyn99(title.font = "Titillium Web",
                   text.font = "Calibri Light",
                   subtitle.size = 14) -> p2

p1/p2

5.2 💐Spongebob Squarepants💐

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1,binwidth = 0.1) +
  labs(title = "F is for Fire that burns down the whole town!",
       subtitle = "U is for Uranium... bombs! N is for No survivors when you're-",
       caption = "Plankton, those things aren't what fun is about!") +
  mytheme

bobspog_plot <- ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1,binwidth = 0.1) +
  scale_fill_spongeBob() +
  labs(title = "F is for Fire that burns down the whole town!",
       subtitle = "U is for Uranium... bombs! N is for No survivors when you're-",
       caption = "Plankton, those things aren't what fun is about!") +
  theme_spongeBob(title.font = "Some Time Later",
                  text.font = "Some Time Later",
                  title.size = 22,
                  subtitle.size = 16,
                  axis.title.size = 16,
                  axis.text.size = 14,
                  legend.title.size = 14)

bobspog_plot

# ## use a themed background! Inspired by ggpomological::paint_pomological()!
# paintBikiniBottom(plot = bobspog_plot,
#                   background = "background") 

5.3 💐Game of Thrones: House Stark, Tully, Targaryen💐

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  labs(title = "The winters are hard, but the Starks will endure.",
       subtitle = "We always have...",
       caption = "Winter Is Coming...") +
  scale_y_continuous(expand = c(0,0)) +
  scale_x_continuous(expand = c(0,0)) +
  scale_fill_westeros(palette = "Stark") +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 14)) -> stark

ggplot(diamonds, aes(price, fill = cut)) +
  geom_histogram(binwidth = 500) +
  scale_fill_westeros(palette = "Tully", n = 5) +
  labs(title = "I've seen wet shits I like better than Walder Frey.",
       subtitle = "Pardon my lord, my lady. I need to find a tree to piss on.",
       caption = "- The Blackfish") +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 10),
        title = element_text(family = "Cinzel", size = 14)) -> tully
ggplot(gapminder::gapminder, 
       aes(x = log10(gdpPercap), y = lifeExp)) +
  geom_point(aes(color = continent)) + 
  scale_x_log10() +
  scale_color_westeros(palette = "Targaryen") +
  labs(title = "I am the blood of the dragon. I must be strong.",
       subtitle = "I must have fire in my eyes when I face them, not tears.",
       caption = "- Fire & Blood.") +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 10),
        title = element_text(family = "Cinzel", size = 14)) -> targaryen
(stark + tully) /  targaryen
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

5.4 💐Game of Thrones: House Tyrell, Lannister, Greyjoy💐

p_load(gapminder)
gapminder::gapminder %>% head(200)
gapminder %>% 
  filter(country %in% c("France", "Germany", "Ireland", "Italy", "Japan", "Norway", "Belarus")) %>% 
  mutate(year = ymd(paste(year,"01-01",sep = "-"))) -> data
data 
data %>% 
  ggplot(aes(year,gdpPercap,fill = country)) +
  geom_area(alpha = 0.7) +
  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))
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
(tyrell + lannister)/greyjoy

5.5 💐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
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
(arryn + manderly)/martell
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

5.6 💐Game of Thrones: Stannis Baratheon, The One True King💐

mpg %>% 
  ggplot(aes(displ)) +
  geom_histogram(aes(fill = class),col = "black",size = 0.1) +
  scale_x_continuous(expand = c(0,0)) +
  scale_fill_westeros(palette = "Stannis", n = 7, reverse = TRUE) +
  scale_y_continuous(expand = c(0,0)) +
  labs(title = glue("
                    We do not choose our destinies. 
                    Yet we must... we must do our duty, no? 
                    Great or small, we must do our duty."),
       subtitle = "I will have no burnings. Pray Harder.",
       caption = glue("
                      The Iron Throne is Mine by Right.
                      - Stannis Baratheon"),
       x = "Bent Knees", 
       y = "Lightbringer") +
  theme_minimal() +
  theme(text = element_text(family = "Cinzel", size = 20),
        plot.title = element_text(family = "Cinzel", size = 26),
        plot.subtitle = element_text(size = 18),
        plot.caption = element_text(size = 16),
        axis.text = element_text(size = 18),
        legend.position = "none") 
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

mpg %>% 
  ggplot(aes(displ)) +
  geom_histogram(aes(fill = class),col = "black",size = 0.1) +
  scale_x_continuous(expand = c(0,0)) +
  scale_y_continuous(expand = c(0,0)) +
  labs(title = glue("
                    We do not choose our destinies. 
                    Yet we must... we must do our duty, no? 
                    Great or small, we must do our duty."),
       subtitle = "I will have no burnings. Pray Harder.",
       caption = glue("
                      The Iron Throne is Mine by Right.
                      - Stannis Baratheon"),
       x = "Bent Knees", 
       y = "Lightbringer") +
  theme_minimal() +
  mytheme   # 写成函数简化code
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

5.7 💐The Simpsons💐

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_simpsons() +
  labs(title = "The Simpsons",
       subtitle = "Theme inspired in part by @nathancunn's blog posts",
       caption = glue("
                      A 'Bake 'em Away, Toys!' Production
                      Location: Sector 7G"),
       x = "Wel-diddly-elcome neighborino!",
       y = "Price of Duff Beer") +
  theme_simpsons(title.font = "Akbar",
                 text.font = "Akbar",
                 axis.text.size = 8)

5.8 💐Rick and Morty💐

ggplot(diamonds, aes(price, fill = cut)) +
  geom_histogram(binwidth = 500) +
  scale_fill_rickAndMorty() +
  labs(title = "Dammit Morty, You Know Diamonds Aren't Forever Right?",
       subtitle = "They're blood diamonds, Morty **burp**",
       caption = "Wubbalubbadubdub!") +
  theme_rickAndMorty(title.font = "Get Schwifty",
                     text.font = "Get Schwifty",
                     title.size = 14)

5.9 💐Avatar: The Last Airbender💐

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

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

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

(firenation + airnomads)/(watertribe + earthkingdom)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

试试自己写的mytheme咋样

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  labs(title = "Flameo, Hotman!",
       subtitle = "Fire. Wang Fire. This is my wife, Sapphire.",
       x = "Lion Vultures Owned",
       y = "Agni Kai Participation") +
  ggthemes::theme_economist() +
  mytheme -> firenation

ggplot(gapminder::gapminder,
       aes(x = log10(gdpPercap), y = lifeExp)) +
  geom_point(aes(color = continent)) + 
  scale_x_log10() +
  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") +
  ggthemes::theme_economist() +
  mytheme -> watertribe

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  labs(title = "There is no war in Ba Sing Se",
       subtitle = "(Welcome to Lake Laogai)") +
  ggthemes::theme_economist() +
  mytheme -> earthkingdom

airquality %>% 
  mutate(Month = as.factor(Month)) %>% 
  ggplot(aes(x = Day, y = Temp, group = Month, color = Month)) +
  geom_line(size = 1.5) +
  labs(title = "Let's head to the Eastern Air Temple!",
       subtitle = "Appa, Yip Yip!") +
  ggthemes::theme_economist() +
  mytheme -> airnomads

(firenation + airnomads)/(watertribe + earthkingdom)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  labs(title = "Flameo, Hotman!",
       subtitle = "Fire. Wang Fire. This is my wife, Sapphire.",
       x = "Lion Vultures Owned",
       y = "Agni Kai Participation") +
  # ggthemes::theme_economist() +
  mytheme -> firenation

ggplot(gapminder::gapminder,
       aes(x = log10(gdpPercap), y = lifeExp)) +
  geom_point(aes(color = continent)) + 
  scale_x_log10() +
  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") +
  # ggthemes::theme_economist() +
  mytheme -> watertribe

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  labs(title = "There is no war in Ba Sing Se",
       subtitle = "(Welcome to Lake Laogai)") +
  # ggthemes::theme_economist() +
  mytheme -> earthkingdom

airquality %>% 
  mutate(Month = as.factor(Month)) %>% 
  ggplot(aes(x = Day, y = Temp, group = Month, color = Month)) +
  geom_line(size = 1.5) +
  labs(title = "Let's head to the Eastern Air Temple!",
       subtitle = "Appa, Yip Yip!") +
  # ggthemes::theme_economist() +
  mytheme -> airnomads

(firenation + airnomads)/(watertribe + earthkingdom)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

5.10 💐Parks and Recreation💐

airquality %>% 
  mutate(Month = as.factor(Month)) %>% 
  ggplot(aes(x = Day, y = Temp, group = Month, color = Month)) +
  geom_point(size = 4.5) +
  labs(title = "Calzones are pointless.", 
       subtitle = "They're just pizza that's harder to eat!",
       caption = "No one likes them. Good day, sir.") + 
  scale_color_parksAndRec() + 
  theme_minimal() +
  theme_parksAndRec(text.font = "Titillium Web",
                    title.font = "Titillium Web Black",
                    legend.font = "Titillium Web") -> parksandrec

ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = class), col = "black", size = 0.1) +
  labs(title = "Parks & Recreation",
       subtitle = "Gotta Spend Money To Make Money!",
       caption = "And I spent... all of my money!") +
  scale_fill_parksAndRec() + 
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0)) +
  theme_minimal() +
  theme_parksAndRecLight(title.font = "Titillium Web Black",
                    text.font = "Titillium Web") -> parksandreclight

parksandrec + parksandreclight
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

5.11 💐Attack on Titan💐

img <- png::readPNG(system.file("backgrounds/aot-titan.png", 
                                package = "tvthemes"))
ggplot(mpg, aes(displ)) +
  geom_histogram(aes(fill = rev(class)), col = "black", size = 0.1) +
  scale_fill_attackOnTitan(reverse = FALSE) +
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0)) +
  # annotation_raster(img, xmin = 4.75, xmax = 7.75, 
  #                   ymin = 7, ymax = 33) +
  labs(title = "On That Day, Mankind Received A Grim Reminder.",
       subtitle = "Well, Sweet Mother Theresa on the Hood of a Mercedes Benz!",
       caption = "W-Well I'll Just Bertell You What I Berthold Him..") +
    theme_parksAndRec(text.font = "Roboto Condensed",
                      title.font = "Roboto Condensed")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

5.12 💐Kim Possible💐

ggplot(data = data, aes(x = year, 
                        y = gdpPercap,
                        fill = country)) +
  geom_area(alpha = 0.9) +
  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_kimPossible() +
  labs(title = "What's The Sitch, Wade?",
       subtitle = glue("Call Me {emo::ji('call')} Beep Me {emo::ji('pager')}  If You Wanna Reach Me {emo::ji('clap')} !"),
       caption = "Stoppable... What Are You Doing In My House??",
       x = "Year", 
       y = "GDP per Capita") +
  theme_spongeBob(title.font = "Roboto Condensed",
                  text.font = "Roboto Condensed",
                  title.size = 24,
                  subtitle.size = 20,
                  text.size = 18,
                  legend.title.size = 14,
                  legend.text.size = 12,
                  ticks = TRUE)

5.13 💐Big Hero 6💐

data <- gapminder::gapminder %>% 
  filter(country %in% c("France", "Germany", "Ireland", "Italy", 
                        "Japan", "Norway", "Finland", "United Kingdom")) %>% 
  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.9) +
  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_bigHero6() +
  labs(title = stringr::str_wrap("Welcome To The Nerd Lab.", width = 50),
       subtitle = "Villains Love Exposed Pipes, Beams, and Plastic Tarps!",
       caption = "*Fist Bump* Falalalalalala~",
       x = "Year", y = "GDP per Capita") +
  theme_spongeBob(title.font = "Roboto Condensed",
                  text.font = "Roboto Condensed",
                  title.size = 24,
                  subtitle.size = 20,
                  text.size = 18,
                  legend.position = "none") -> bigherobar

airquality %>% 
  mutate(Month = as.factor(Month)) %>% 
  ggplot(aes(x = Day, y = Temp, group = Month, fill = Month)) +
  geom_point(size = 4, stroke = 1.25, shape = 21) +
  labs(title = "Hiro, I Will Always Be With You.", 
       subtitle = "I'm Satisfied With My Care, Baymax.",
       caption = "Stop Whining, Woman Up!") + 
  scale_fill_bigHero6() + 
  theme_minimal() +
  theme(text = element_text(family = "Roboto Condensed"),
        plot.title = element_text(size = 20),
        plot.subtitle = element_text(size = 16),
        plot.caption = element_text(size = 14)) -> bigherodot

## plot together:
bigherobar + bigherodot

5.14 💐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

(hildaday + hildadusk) / hildanight
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

5.15 💐Gravity Falls💐

ggplot(data = data, aes(x = year, y = gdpPercap, fill = country)) +
  geom_area(alpha = 0.9) +
  scale_x_date(expand = c(0, 0), breaks = data$year, date_labels = "%Y") +
  scale_y_continuous(expand = c(0, 0), labels = scales::dollar) +
  mytheme

ggplot(data = data, aes(x = year, y = gdpPercap, fill = country)) +
  geom_area(alpha = 0.9) +
  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_gravityFalls(reverse = FALSE)

ggplot(data = data, aes(x = year, y = gdpPercap, fill = country)) +
  geom_area(alpha = 0.9) +
  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_gravityFalls(reverse = FALSE) +
  labs(title = stringr::str_wrap("Well, Duck-tective, it seems you've really... quacked the case!", width = 70),
       subtitle = "Quack-quack Quack-quack-quack (Don't patronize me!)",
       caption = "Schmebulock!!",
       x = "Years That Stanford Was Gone", y = "# of Sham Total sold") +
  theme_avatar(title.font = "Gravitation Falls",
               text.font = "Gravitation Falls",
               title.size = 24,
               subtitle.size = 20,
               text.size = 18,
               legend.position = "none")