Package 'Rokemon'

Title: Pokemon Style Plotting And Data
Description: This package implements several themes for ggplot to bring your data into the world of Pokemon.
Authors: David Schoch [aut, cre]
Maintainer: David Schoch <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1
Built: 2024-11-18 05:09:33 UTC
Source: https://github.com/schochastics/rokemon

Help Index


Pokemon Go Team Logos

Description

Enhance your plots with a background picture of your favorite Pokemon Go team.

Usage

annotate_pogo(team = "mystic", opacity = 0.5)

Arguments

team

string. either 'mystic', 'valor' or 'instinct'

opacity

opacity of team logo.

References

The logos were not designed by me. All credit goes to this guy.

Examples

## Not run: 
library(tidyverse)

pokemon %>%
 dplyr::filter(type1=="water") %>%
 ggplot(aes(defense,attack))+
 annotate_pogo(team = "mystic")+
 geom_point()+
 theme_mystic()+
 labs(title="Team Mystic",subtitle="Water Pokemon")

## End(Not run)

HP bar chart

Description

A barchart in the style of a HP bar.

Usage

gghealth(data, names, values, sort.names = TRUE, init.size = 3,
  cuts = c(0.8, 0.4, 0.2))

Arguments

data

data.frame.

names

column name of names to use in the plot.

values

column name of values to plot.

sort.names

order names according to value (TRUE, default) or not (FALSE).

init.size

size of the healthbar. See details.

cuts

numeric vector of length 3. See details.

Details

init.size controls the height of the bar. The more names are used, the smaller the value should be. The values in cuts should be decreasing in the interval (0,1).

Examples

## Not run: 
gghealth(pokemon[1:10,],"name","base_total",init.size = 5)+
 labs(x="",y="Stats Total")

## End(Not run)

Import Pokefonts

Description

Use this function to import the Pokemon Fonts to R.

Usage

import_pokefont()

Pokemon inspired Palettes

Description

Color palettes generated from Pokemon sprites.

Usage

poke_pal(name, n)

display_poke_pal(name = "pikachu")

Arguments

name

string. name of a Pokemon who's colors should be used

n

integer specifying the number of colors to return.

Details

display_poke_pal can be used to display colors of a poke palette. All palettes were computed automatically and might not all be very meaningful. Other (and better) pokemon palettes can be found in the package palettetown

Value

A color palette

Examples

poke_pal("pikachu",3)

Poke Pie Charts

Description

Create Pie Charts of the color distribution of Pokemon sprites.

Usage

poke_pie(path_to_sprites = "", poke)

Arguments

path_to_sprites

path to sprite files. See Details

poke

name or pokedex number of Pokemon

Details

Sprites are not provided and have to be download prior of usage. It is important that the sprites are numbered from 1.png to 801.png. https://github.com/PokeAPI/sprites contains all sprites in the right format and has been used for testing.


Pokemon Data

Description

Pokemon Data

Usage

pokemon

Format

A data frame containing various stats from 801 pokemon. Use str(pokemon) for more details.

References

Pokémon data download from Kaggle: https://www.kaggle.com/rounakbanik/pokemon, originally scraped from http://serebii.net/


Rokemon

Description

An R package for your favorite game. More Help can be found on github: https://github.com/schochastics/Rokemon


Pokemon color scale

Description

This allows to use the Pokemon type color scale in ggplot.

Usage

scale_color_poketype(...)

scale_fill_poketype(...)

Arguments

...

common discrete scale parameters for ggplot

Examples

library(ggplot2)

ggplot(pokemon,aes(defense,attack))+
  geom_point(aes(col=type1))+
  scale_color_poketype()

ggplot(pokemon,aes(type1))+
  geom_bar(aes(fill=type1))+
  scale_color_poketype()

Classic Gamyboy inspired ggplot theme

Description

Theme based on the first generation of the Gameboy.

Usage

theme_gameboy()

Examples

## Not run: 
library(ggplot2)

ggplot(pokemon,aes(attack,defense))+
 geom_point(shape = 15,col = c("#006400"),size=2)+
 theme_gameboy()+
 labs(title = "Classic Gameboy Theme")

## End(Not run)

Gamyboy Advanced inspired ggplot theme

Description

Theme based on the Gameboy Advanced.

Usage

theme_gba()

Examples

## Not run: 
library(ggplot2)

ggplot(pokemon,aes(attack,defense))+
 geom_point(shape = 15,col = c("#006400"),size=2)+
 theme_gameboy()+
 labs(title = "Classic Gameboy Theme")

## End(Not run)

Theme Instinct

Description

ggplot theme that simply adds a yellow background to the plot.

Usage

theme_instinct()

Theme Mystic

Description

ggplot theme that simply adds a blue background to the plot.

Usage

theme_mystic()

Theme Rocket

Description

ggplot theme of Team Rocket. Meowth that's right!

Usage

theme_rocket(...)

Arguments

...

additional parameters to ggplot2::theme()

Examples

## Not run: 
#create a Pokemon type effectiveness chart
library(tidyverse)

pokemon %>%
  distinct(type1,.keep_all=TRUE) %>%
  select(defender = type1,against_bug:against_water) %>%
  gather(attacker,effect,against_bug:against_water) %>%
  mutate(attacker = str_replace_all(attacker,"against_",""))  %>%
  ggplot(aes(y=attacker,x=defender,fill=factor(effect)))+
  geom_tile()+
  geom_text(aes(label=ifelse(effect!=1,effect,"")))+
  scale_fill_manual(values=c("#8B1A1A", "#CD2626", "#EE2C2C", "#FFFFFF", "#00CD00", "#008B00"))+
  theme_rocket(legend.position="none")+
  labs(title="Effectiveness Table")

## End(Not run)

Health bar theme

Description

Theme used in gghealth.

Usage

theme_status()

Theme Valor

Description

ggplot theme that simply adds a red background to the plot.

Usage

theme_valor()