This package lets you plot & save customly colored gameboys based on ggplot2.
To use this package, you'll need to have the following packages installed:
install.packages(c("ggplot2", "statebins", "extrafont")) #run once
extrafont::register_fonts() #run once
extrafont::loadfonts(quiet = TRUE) #run once in every new R session
The package can be installed via:
devtools::install_github("toebR/ggameboy")
library(gameboy)
The package use is fairly easy.
The following function plots a default monochrome gameboy:
gameboy_plot() -> test
test
The plot can be saved in your working directory with an optimised width:height ratio with a simple export function:
save_gameboy_png(plotvar = test, dpi = 300, name = "test_export") #default parameters which can be changed
The gameboy_plot() function allows you to change EVERY color of almost all elements of the gameboy as well as the screen text.
The following infographic shows which parameters change what element of the plot:
Once the parameters are clear, it's easy to change some element and make your custom gameboy:
gameboy_plot(background = "white", case = "green", screentext = "Custom Gameboy")
Since the gameboy is basically a ggplot2 plot, you can add a title etc. to your pleasing.
P <- gameboy_plot(background = "grey", case = "darkblue", screentext = "I played Pokémon on this one")
P + ggtitle("This is a title") +
labs(caption = "This is a caption")
Lets say you want to arrange some of your gameboys into one plot.I did this easily with patchwork:
The gameboys have a bit of a different width:height ration but you get the idea.
library(patchwork)
(gameboy_monochrome + gameboy_turquoise)/(gameboy_green + gameboy_red) / (gameboy_yellow + gameboy_purple) -> patch
patch + plot_annotation(title = "\nWHAT WE CAN DO WITH {GGPLOT2}\n", caption = "Code & Design by Tobias Stalder (@toeb18)",
theme = theme(
plot.background = element_rect(fill = "#293133", color = "#293133"),
panel.background = element_rect(fill = "#E0E0E0", color = "#E0E0E0"),
plot.title = element_text(size = 30, color = "white", family = "Consolas", hjust = .5),
plot.caption = element_text(size = 10, color = "white", family = "Consolas", hjust = .5)
)) -> gameboy_poster
The "GAMEBOY" brand is under copyright from © 2021 Nintendo.