Skip to content

goboru/GhibliBrewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GhibliBrewer

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!

Instalation

GhibliBrewer is a R package that can be installed via github.

install.packages("devtools")

devtools::install_github("goboru/GhibliBrewer")

Usage

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()

All

# 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")

Integration with ggplot2

Add discrete palette to ggplot:

ggplot(diamonds, aes(x = cut, fill=cut)) +
  geom_bar()+
  scale_fill_ghib_d("Howl-FireDemon", n=5)

ggplot-discrete

Add continuous palette to ggplot:

ggplot(diamonds, aes(x = price, y = depth, color=depth)) +
  geom_point() +
  scale_color_ghib_c("Mononoke-Guardian")

ggplot-continuous

ggplot(diamonds, aes(x = log(price), y = carat)) +
  geom_hex() +
  scale_fill_ghib_c("Heron-Jelly")

ggplot-continuous2

Colorblind-friendly palette assistance

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)

all-cb

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)

Editing a palette considering colorblindness

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")

colorblind-example

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)

colorblind-improved

GhibliBrewer palettes

All palettes

All

Nausicaä of the Valley of the Wind (1984)

Nausicaa-Pilot

NP

Nausicaa-Bug

NB

Castle in the Sky (1986)

Sky-Necklace

SN

Sky-Grass

SG

Sky-Pirate

SP

My neighbour Totoro (1988)

Totoro-Mouth

TM

Totoro-Catbus

TC

Totoro-House

TH

Totoro-School

TS

Totoro-Umbrella

TU

Kiki's Delivery Service (1989)

Kiki-Beach

KB

Only Yesterday (1991)

Yesterday-Park

YP

Porco Rosso (1992)

Porco-Plane

PP

Porco-Cave

PC

Porco-Garden

PG

Pom Poko (1994)

Pompoko-Fortune

PF

On Your Mark (1995)

Mark-Car

MC

Whisper of the Heart (1995)

Whisper-Roads

WR

Whisper-Rock

WK

Princess Mononoke (1997)

Mononoke-Hug

MH

Mononoke-Knife

MK

Mononoke-Guardian

MG

My Neighbors the Yamadas (1999)

Yamadas

Y

Spirited away (2001)

Chihiro-Dragon

CD

Chihiro-Lump

CL

Chihiro-Bridge

CB

Chihiro-NoFace

CN

Chihiro-Banquet

ChB

Chihiro-Magic

CM

The Cat Returns (2002)

Cat-Vals

CV

Cat-Prince

CP

Cat-Broom

CaB

Cat-Bubble

CatB

Howl's Moving Castle (2004)

Howl-Horizon

HH

Howl-Peace

HoP

Howl-Terrace

HT

Howl-FireDemon

HF

Howl-Star

HS

Howl-Breakfast

HB

Howl-Castle

HC

Howl-Heart

HoH

Tales from Earthsea (2006)

Earthsea-Silk

ES

Earthsea-Lightning

EL

Ponyo (2008)

Ponyo-Joy

PJ

Ponyo-Ramen

PR

Ponyo-Boat

PB

Ponyo-Trash

PT

Ponyo-Godess

PoG

Arrietty (2010)

Arrietty-Garden

AG

Arrietty-Bedroom

AB

The Wind Rises (2013)

Wind-Timer

WT

Wind-Kiss

WK

The Tale of the Princess Kaguya (2013)

Kaguya-Kimono

KK

When Marnie Was There (2014)

Marnie-Bedroom

MB

Marnie-Train

MT

Marnie-Boat

MaB

The Boy and the Heron (2023)

Heron-Troop

HeT

Heron-Jelly

HJ

Heron-Parrots

HP

Heron-Hug

HeH

If you have come this far, why don't you try your expertise with game.ghib() ?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages