Transform your R plots with palettes inspired by the beautiful visuals of Studio Ghibli movies!
This package was based on coding from the MetBrewer package. All original images belong to Studio Ghibli (CC-licensed), and can be accessed through their website.
This package was equally developed by Gonzalo Borrego-Yaniz and Javier MartĂnez-LĂłpez. For requests, questions and comments, feel free to reach out to us!
GhibliBrewer is a R package that can be installed via github.
install.packages("devtools")
devtools::install_github("goboru/GhibliBrewer")
Create a palette:
palette <- ghibli.brewer("Howl-Castle")
palette <- ghibli.brewer(palette="Totoro-Mouth", direction="default", type="discrete", n=5)
- palette: String, name of the palette
- direction: "default", "reverse" or "random". "default" if not specified.
- type: "discrete" or "continuous". "discrete" if not specified.
- n: Number of colors, up to the maximum of colors predefined in the palette. Maximun size of the palette by default.
Display an individual palette:
# Run the ghibli.brewer() function without assigning the output to a variable
ghibli.brewer(palette="Totoro-Mouth", direction="default", type="discrete", n=5)
Display all palettes:
# All palettes as set by default
display.ghibli()
# Display all palettes with a specific number of colors with "n"
display.ghibli(n=4)
# Change the direction of the palettes with "direction"
display.ghibli(direction="random")
Add discrete palette to ggplot:
ggplot(diamonds, aes(x = cut, fill=cut)) +
geom_bar()+
scale_fill_ghib_d("Howl-FireDemon", n=5)
Add continuous palette to ggplot:
ggplot(diamonds, aes(x = price, y = depth, color=depth)) +
geom_point() +
scale_color_ghib_c("Mononoke-Guardian")
ggplot(diamonds, aes(x = log(price), y = carat)) +
geom_hex() +
scale_fill_ghib_c("Heron-Jelly")
We carefully created and tested colorblind-friendly palettes in our package. In addition, we also added the option for the user to study themself which colors in a palette are more problematic in regard to colorblind-friendliness. It is important to note that while some palettes aren't labeled as "colorblind-friendly," removing one or two colors can help achieve that. Our function to visualize palettes and check if they are clolorblind-friendly also work with any palette defined by the user.
Display all colorblind-friendly palettes:
display.ghibli(colorblind_only = T)
Simulate a GhibliBrewer palette in the way that a person with protanopia, deuteranopia, or tritanopia would see them, respectively:
plot.colorblind.ghib("Totoro-Mouth")
Simulate any palette in the way that a person with protanopia, deuteranopia, or tritanopia would see them, respectively:
palette <- c('red', 'green', 'orange', 'black')
plot.colorblind.palette(palette)
A good example of a palette that is close to being colorblind-friendly is "Howl-Peace". We can visualize this palette using plot.colorblind.ghib()
plot.colorblind.ghib("Howl-Peace")
You can notice that the most problematic combination in this palette is between colors 4-7(deuteranopia and protanopia) and 2-7(tritanopia). We can remove one of them (#7), and you can see that there is no highly-problematic combination now:
palette <- ghibli.brewer("Howl-Peace")[c(1,2,3,4,5,6)]
plot.colorblind.palette(palette)
If you have come this far, why don't you try your expertise with game.ghib() ?