README.md

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')
#>  [1] "#1a343c" "#1e2e2d" "#3a7589" "#58b3d2" "#5fb2b0" "#3f706f" "#244a57"
#>  [8] "#4a96a1" "#71e3fd" "#559d9c" "#7edfde" "#c3aa82" "#dfc793" "#ecd5a5"
#> [15] "#786648" "#2e4a4a"
pokepals('007')
#>  [1] "#1a343c" "#1e2e2d" "#3a7589" "#58b3d2" "#5fb2b0" "#3f706f" "#244a57"
#>  [8] "#4a96a1" "#71e3fd" "#559d9c" "#7edfde" "#c3aa82" "#dfc793" "#ecd5a5"
#> [15] "#786648" "#2e4a4a"

Access a random color palette:

pokepals('random')
#>  [1] "#606c4d" "#466138" "#10140f" "#0c1c1d" "#252c1b" "#9caa7f" "#e5f3c1"
#>  [8] "#364927" "#87ab72" "#32667a" "#6e9553" "#bbce97" "#80955e" "#3e482d"
#> [15] "#aecd9b" "#c6e4b9"

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.