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 |
Enhance your plots with a background picture of your favorite Pokemon Go team.
annotate_pogo(team = "mystic", opacity = 0.5)
annotate_pogo(team = "mystic", opacity = 0.5)
team |
string. either 'mystic', 'valor' or 'instinct' |
opacity |
opacity of team logo. |
The logos were not designed by me. All credit goes to this guy.
## 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)
## 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)
A barchart in the style of a HP bar.
gghealth(data, names, values, sort.names = TRUE, init.size = 3, cuts = c(0.8, 0.4, 0.2))
gghealth(data, names, values, sort.names = TRUE, init.size = 3, cuts = c(0.8, 0.4, 0.2))
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. |
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).
## Not run: gghealth(pokemon[1:10,],"name","base_total",init.size = 5)+ labs(x="",y="Stats Total") ## End(Not run)
## Not run: gghealth(pokemon[1:10,],"name","base_total",init.size = 5)+ labs(x="",y="Stats Total") ## End(Not run)
Use this function to import the Pokemon Fonts to R.
import_pokefont()
import_pokefont()
Color palettes generated from Pokemon sprites.
poke_pal(name, n) display_poke_pal(name = "pikachu")
poke_pal(name, n) display_poke_pal(name = "pikachu")
name |
string. name of a Pokemon who's colors should be used |
n |
integer specifying the number of colors to return. |
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
A color palette
poke_pal("pikachu",3)
poke_pal("pikachu",3)
Create Pie Charts of the color distribution of Pokemon sprites.
poke_pie(path_to_sprites = "", poke)
poke_pie(path_to_sprites = "", poke)
path_to_sprites |
path to sprite files. See Details |
poke |
name or pokedex number of Pokemon |
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
pokemon
pokemon
A data frame containing various stats from 801 pokemon. Use str(pokemon)
for more details.
Pokémon data download from Kaggle: https://www.kaggle.com/rounakbanik/pokemon, originally scraped from http://serebii.net/
An R package for your favorite game. More Help can be found on github: https://github.com/schochastics/Rokemon
This allows to use the Pokemon type color scale in ggplot.
scale_color_poketype(...) scale_fill_poketype(...)
scale_color_poketype(...) scale_fill_poketype(...)
... |
common discrete scale parameters for ggplot |
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()
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()
Theme based on the first generation of the Gameboy.
theme_gameboy()
theme_gameboy()
## 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)
## 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 based on the Gameboy Advanced.
theme_gba()
theme_gba()
## 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)
## 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)
ggplot theme that simply adds a yellow background to the plot.
theme_instinct()
theme_instinct()
ggplot theme that simply adds a blue background to the plot.
theme_mystic()
theme_mystic()
ggplot theme of Team Rocket. Meowth that's right!
theme_rocket(...)
theme_rocket(...)
... |
additional parameters to ggplot2::theme() |
## 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)
## 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)
ggplot theme that simply adds a red background to the plot.
theme_valor()
theme_valor()