-
Notifications
You must be signed in to change notification settings - Fork 18
/
README.Rmd
103 lines (73 loc) · 3.36 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
library(ggplot2)
library(cowplot)
library(ghibli)
```
# ghibli <img src="man/figures/logo.png" width="160px" align="right" />
[![lifecycle](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://www.tidyverse.org/lifecycle/#stable)
[![CRAN status](http://www.r-pkg.org/badges/version/ghibli)](https://cran.r-project.org/package=ghibli)
[![DLs](http://cranlogs.r-pkg.org/badges/ghibli)](http://cran.rstudio.com/web/packages/ghibli/index.html)
[![R-CMD-check](https://github.com/ewenme/ghibli/workflows/R-CMD-check/badge.svg)](https://github.com/ewenme/ghibli/actions)
## Overview
> “No matter how many weapons you have, no matter how great your technology might be, the world cannot live without love!”
—*Castle in the Sky (1986)*
。◕‿‿◕。 Sprinkle some Studio Ghibli palette magic over your plots 。◕‿‿◕。
```{r, echo=FALSE}
p <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_jitter(size = 3) +
theme_minimal() +
# ghibli stuff
scale_colour_ghibli_d("LaputaMedium", direction = -1)
ggdraw() +
draw_plot(p) +
draw_image("man/figures/totoro.png", x = 0.25, y = -0.2, scale = 0.7)
```
## Installation
Install the latest stable version on CRAN...
```{r, eval = FALSE}
install.packages('ghibli')
```
...or get the development version from GitHub.
```{r, eval = FALSE}
# install package from github
remotes::install_github("ewenme/ghibli")
```
## Palettes
```{r out.width="75%", echo=FALSE}
knitr::include_graphics("man/figures/spirited-pal.jpg")
```
`ghibli` provides 9 unique palettes, with a light, medium and dark variant for each.
```{r palettes, fig.height = 5}
# load package
library(ghibli)
# display palettes w/ names
par(mfrow=c(9,3))
for(i in names(ghibli_palettes)) print(ghibli_palette(i))
```
**N.B.** the palettes are [exposed in YAML format](https://raw.githubusercontent.com/ewenme/ghibli/master/inst/extdata/palettes.yml) for easier porting to new libraries.
All colour palettes are stored as `color` objects (courtesy of the [prismatic](https://emilhvitfeldt.github.io/prismatic/index.html) package) inside `ghibli_palettes` with extremely cute printing (if [crayon](https://github.com/r-lib/crayon) is installed) and plotting methods to help you preview flavours.
![](man/figures/prismatic-print.svg)
## In the wild
`ghibli` provides relevant scales for use with `ggplot2`. It only suggests `ggplot2` in order to stay lightweight, but if available you can use the `scale_[colour|fill]_ghibli_[c|d]()` functions:
```{r, ggplot2-eg}
library(ggplot2)
# ggplot stuff
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_jitter(size = 3) +
theme_minimal() +
# ghibli stuff
scale_colour_ghibli_d("LaputaMedium", direction = -1)
```
## Other stuff
- Get citation information for ghibli in R with `citation(package = 'ghibli')`
- Please note that the ghibli project is released with a [Contributor Code of Conduct](https://ewenme.github.io/ghibli//CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
- This package was largely inspired by [Karthik Ram's `wesanderson` package](https://github.com/karthik/wesanderson)
- The palettes themselves come from [Movies in Color](http://moviesincolor.com/). Go check 'em.