knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

PokePals

Color palettes based on Gen I and Gen II Pokémon for use in R. Package inspiration from Barry Mode and Jared Huling.

Installation

You can install the development version of pokepals from GitHub with:

# install.packages("devtools")
devtools::install_github("Angela-Jones/pokepals")

Get color palettes

Access the pokepals color palettes by name or number with pokepals():

library(pokepals)
pokepals('squirtle')
pokepals('007')

Access a random color palette:

pokepals('random')

Display color palettes

Color palettes can be displayed using display_pokepals()

Bulbasaur

display_pokepals("bulbasaur")

Charmander

display_pokepals("charmander")

Squirtle

display_pokepals("squirtle")

Use palettes with ggplot2

Now use scale_color_pokepals() with ggplot2:

library(ggplot2)
library(gridExtra)
data(morley)
pltl <- ggplot(data = morley, aes(x = Run, y = Speed,
group = factor(Expt),
colour = factor(Expt))) +
    geom_line(size = 2) +
    theme_bw() +
    theme(panel.background = element_rect(fill = "grey97"),
          panel.border = element_blank(),
          legend.position = "bottom")
pltd <- ggplot(data = morley, aes(x = Run, y = Speed,
group = factor(Expt),
colour = factor(Expt))) +
    geom_line(size = 2) +
    theme_bw() +
    theme(panel.background = element_rect(fill = "grey15"),
          legend.key = element_rect(fill = "grey15"),
          panel.border = element_blank(),
          panel.grid.major = element_line(color = "grey45"),
          panel.grid.minor = element_line(color = "grey25"),
          legend.position = "bottom")
grid.arrange(pltl + scale_color_pokepals(palette = "squirtle"),
             pltd + scale_color_pokepals(palette = "squirtle"), ncol = 2)
grid.arrange(pltl + scale_color_pokepals(palette = "charmander"),
             pltd + scale_color_pokepals(palette = "charmander"), ncol = 2)

More example plots

grid.arrange(pltl + scale_color_pokepals(palette = "bulbasaur"),
             pltd + scale_color_pokepals(palette = "bulbasaur"), ncol = 2)
grid.arrange(pltl + scale_color_pokepals(palette = "pikachu"),
             pltd + scale_color_pokepals(palette = "pikachu") + 
                 theme(panel.background = element_rect(fill = "grey5")), ncol = 2)
grid.arrange(pltl + scale_color_pokepals(palette = "magikarp"),
             pltd + scale_color_pokepals(palette = "magikarp"), ncol = 2)
pltd <- ggplot(data = OrchardSprays, aes(x = rowpos, y = decrease,
group = factor(treatment),
colour = factor(treatment))) +
    geom_line(size = 2) +
    geom_point(size = 4) +
    theme_bw() +
    theme(panel.background = element_rect(fill = "grey15"),
          legend.key = element_rect(fill = "grey15"),
          panel.border = element_blank(),
          panel.grid.major = element_line(color = "grey45"),
          panel.grid.minor = element_line(color = "grey25"),
          legend.position = "bottom")
pltd + scale_color_pokepals(palette = "jigglypuff")


Angela-Jones/pokecolors documentation built on Dec. 17, 2021, 8:51 a.m.