{"id":13401245,"url":"https://github.com/schochastics/Rokemon","last_synced_at":"2025-03-14T06:32:32.980Z","repository":{"id":44364893,"uuid":"112324826","full_name":"schochastics/Rokemon","owner":"schochastics","description":"Pokemon themed R package ","archived":false,"fork":false,"pushed_at":"2022-01-11T14:26:07.000Z","size":1497,"stargazers_count":94,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-09T04:12:21.352Z","etag":null,"topics":["ggplot2","ggplot2-themes","pokemon","r"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schochastics.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-28T11:08:13.000Z","updated_at":"2024-12-31T17:58:39.000Z","dependencies_parsed_at":"2022-08-30T00:51:10.352Z","dependency_job_id":null,"html_url":"https://github.com/schochastics/Rokemon","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schochastics%2FRokemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schochastics%2FRokemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schochastics%2FRokemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schochastics%2FRokemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schochastics","download_url":"https://codeload.github.com/schochastics/Rokemon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243538060,"owners_count":20307100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ggplot2","ggplot2-themes","pokemon","r"],"created_at":"2024-07-30T19:01:00.328Z","updated_at":"2025-03-14T06:32:31.627Z","avatar_url":"https://github.com/schochastics.png","language":"R","funding_links":[],"categories":["ggplot","R"],"sub_categories":["Themes"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"figures/\",\n  fig.width = 6,\n  fig.height = 4,\n  out.width = '80%',\n  fig.align = \"center\" \n)\n```\n\n# Rokemon \u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"125px\"/\u003e\n\nAn R package to create Pokemon inspired ggplots. It also comes with dataset of 801 Pokemon\nwith 41 different features (Gotta analyze'em all!). \n\n## Overview\n\nFor more details and examples see next sections.\n\nData\n\n* `pokemon`: Data frame containing attributes and stats of 801 Pokemon.\n\nFunctions\n\n* `gghealth()`: HP bar inspired Bar charts.\n* `poke_pie()`: create pie charts from color distribution of Pokemon sprites.\n\nThemes\n\n* `theme_rocket()`: Team Rocket theme\n* `theme_gameboy()` and `theme_gba()`: classic Gameboy and Gameboy Advanced themes\n* `theme_status()`: inspired by Pokemon status bar\n* `theme_mystic()`, `theme_valor()`, `theme_instinct()`: Pokemon Go teams theme; work well with\n`annotate_pogo()`\n* `scale_color_poketype()` and `scale_fill_poketype()`: Provides colors, if Pokemon types are mapped to color/fill \n\nPokemon Palettes\n\n* `poke_pal()`: color palettes created from Pokemon sprites\n* `display_poke_pal()`: view a Pokemon color palette\n\n## Install\n\nThe developer version can be obtained from github.\n```{r install, eval = FALSE}\n#install.packages(\"devtools\")\ndevtools::install_github(\"schochastics/Rokemon\")\n```\n\n```{r load-libs,message=FALSE,warning=FALSE}\nlibrary(Rokemon)\nlibrary(tidyverse)\n\ndata(pokemon)\n```\n\n## Themes\n\nThe package includes several themes for ggplot. \n\n### Theme Rocket\n\n*(See what I did there...)*\n\n```{r theme-rocket}\nggplot(pokemon,aes(attack,defense))+\n  geom_point(col = \"grey\")+\n  theme_rocket()+\n  labs(x = \"Jessy\",y = \"James\",\n       title = \"Theme Rocket\",\n       subtitle = \"blast off at the speed of light!\",\n       caption = \"meowth that's right\")\n\n```\n\n### Gamyboy theme\n\nIf you want to get nostalgic.\n\n```{r theme-gameboy}\nggplot(pokemon,aes(attack,defense))+\n  geom_point(shape = 15,col = \"#006400\",size=2)+\n  theme_gameboy()+\n  labs(title = \"Classic Gameboy Theme\")\n\n```\n\n\n```{r theme-gba}\nggplot(pokemon,aes(attack,defense))+\n  geom_point(shape = 15,col = \"#27408B\",size=2)+\n  theme_gba()+\n  labs(title = \"Gameboy Advanced Theme\")\n```\n\n\n### Status theme and HP bar chart\n\nA theme inspired by HP bar in older Pokemon games. The theme is used in `gghealth`,\na function that plots bar charts in HP bar style.\n\n```{r gghealth}\npokemon[1:10,] %\u003e% \n  gghealth(\"name\",\"base_total\",init.size = 5)+\n  labs(x=\"\",y=\"Stats Total\")\n\n```\n\n### Pokemon Go\n\nAnnotate your plots with the logo of your favorite Pokémon Go team.\n\n```{r pogo-teams,fig.height=4,fig.width=10}\n\np1 \u003c- pokemon %\u003e%\n  dplyr::filter(type1==\"water\") %\u003e%\n  ggplot(aes(defense,attack))+geom_point()+annotate_pogo(team = \"mystic\")+theme_mystic()+\n  labs(title=\"Team Mystic\",subtitle=\"Water Pokemon\")\n\np2 \u003c- pokemon %\u003e%\n  dplyr::filter(type1==\"fire\") %\u003e%\n  ggplot(aes(defense,attack))+geom_point()+annotate_pogo(team = \"valor\")+theme_valor()+\n  labs(title=\"Team Valor\",subtitle=\"Fire Pokemon\")\n\np3 \u003c- pokemon %\u003e%\n  dplyr::filter(type1==\"electric\") %\u003e%\n  ggplot(aes(defense,attack))+geom_point()+annotate_pogo(team = \"instinct\")+theme_instinct()+\n  labs(title=\"Team Instinct\",subtitle=\"Electric Pokemon\")\n\ngridExtra::grid.arrange(grobs=list(p1,p2,p3),ncol=3)\n\n```\n\n## Poke Pie\n\nCreate pie charts of the color distribution of Pokemon sprites. Download all sprites, for\nexample from [here](https://github.com/PokeAPI/sprites).\n\n```{r poke-pie,eval=FALSE}\n#basic usage\npoke_pie(path_to_sprites,pokemon_name)\n```\n\n![](figures/poke-pies.png)\n\nThe function is a reimplementation of [this](https://gist.github.com/need12648430/4d681c9d1b18745ce159)\ncode, which was posted on [reddit](https://www.reddit.com/r/pokemon/comments/2ey1pw/last_night_i_wrote_a_processing_script_that/ck45c21/) a while ago.\n\n## Color Palettes\n\nThe package also includes color palettes, which were automatically generated from\nall 801 pokemon sprites. \n```{r poke-pals,eval=FALSE}\npoke_pal(name,n)\ndisplay_poke_pal(name)\n```\n![](figures/palettes.png)\n\nAdditionally there is also a palette Pokemon Types, used by `scale_color_poketype()` and\n`scale_fill_poketype()`.\n![](figures/rocket-type-pal.png)\n\nI did not check all Pokemon palettes, so there may well be\nsome meaningless ones. A better alternative would be to use the dedicated package `palettetown`.\nSee the github [repo](https://github.comt/imcdlucas/palettetown) for help. \n```{R palettes, eval=FALSE}\ninstall.packages('palettetown')\n```\n\n## Fonts\n\nThe package uses an old school gameboy font for some of its themes, which\ncan be download [here](https://github.com/Superpencil/pokemon-font/releases/tag/v1.8.1).\n\nIn order to use the font in R you need the `extrafont` package.\n```{R install-fonts, eval=FALSE}\n#install.packages(\"extrafont\")\nextrafont::font_import() #only run ones\nextrafont::loadfonts()\n```\n\nAlternatively, you can use the function `import_pokefont()`.\n```{r import-fonts,eval=FALSE}\nimport_pokefont()\n```\n\n## Example use of data\n\nUsing `theme_rocket()` to create an effectiveness table of Pokemon types.\n```{r effectiveness,fig.width=9,fig.height=6}\npokemon %\u003e%\n  distinct(type1,.keep_all=TRUE) %\u003e%\n  select(defender = type1,against_bug:against_water) %\u003e%\n  gather(attacker,effect,against_bug:against_water) %\u003e%\n  mutate(attacker = str_replace_all(attacker,\"against_\",\"\"))  %\u003e%\n  ggplot(aes(y=attacker,x=defender,fill=factor(effect)))+\n  geom_tile()+\n  geom_text(aes(label=ifelse(effect!=1,effect,\"\")))+\n  scale_fill_manual(values=c(\"#8B1A1A\", \"#CD2626\", \"#EE2C2C\", \"#FFFFFF\", \"#00CD00\", \"#008B00\"))+\n  theme_rocket(legend.position=\"none\")+\n  labs(title=\"Effectiveness Table\")\n\n```\n\nUsing Pokemon type colors\n\n```{r poketype-colors}\nggplot(pokemon,aes(defense,attack))+\n  geom_point(aes(col=type1))+\n  scale_color_poketype()+\n  theme_bw()\n```\n\n\n## Addendum\n\n* Logo created by [ZeroDawn0D](https://github.com/ZeroDawn0D)\n* Pogo Logos downloaded [here](https://dribbble.com/shots/2831980-Pok-mon-GO-Team-Logos-Vector-Download)\n* Pokémon data download from [Kaggle](https://www.kaggle.com/rounakbanik/pokemon), originally\nscraped from [serebii.net](http://serebii.net/)\n* Sprites for `poke_pie` can be found [here](https://github.com/PokeAPI/sprites)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschochastics%2FRokemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschochastics%2FRokemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschochastics%2FRokemon/lists"}