-
Notifications
You must be signed in to change notification settings - Fork 23
/
README.Rmd
75 lines (51 loc) · 1.77 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
---
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "figure/",
fig.height = 1
)
```
# emoGG(plot)
Use emoji in your `ggplot2` plots.
This is silly.
## Installation
```r
devtools::install_github("dill/emoGG")
```
## Usage
```{r, load-package}
library(ggplot2)
library(emoGG)
```
First need to find an emoji, using the `emoji_search` function. First look for a tulip:
```{r find-tulip}
emoji_search("tulip")
```
The `iris` example with **real** irises (well, tulips...)
```{r iris_ex, fig.height=4, fig.width=4}
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_emoji(emoji="1f337")
```
What about plotting `mtcars` with **real** cars?
```{r mtcars, fig.height=4, fig.width=4}
ggplot(mtcars, aes(wt, mpg))+ geom_emoji(emoji="1f697")
```
Want to map `emoji` as an aesethetic? [Check out this gist](https://gist.github.com/dill/28bb04fc35b51326f01b23d078f5021e)!
Some random cats?
```{r, catplotlib, fig.height=4, fig.width=4}
posx <- runif(50, 0, 10)
posy <- runif(50, 0, 10)
ggplot(data.frame(x = posx, y = posy), aes(x, y)) + geom_emoji(emoji="1f63b")
```
We can also just put a big emoji in the background:
```{r big-emoji, fig.height=4, fig.width=4}
qplot(x=Sepal.Length, y=Sepal.Width, data=iris, geom="point") + add_emoji(emoji="1f337")
```
## Acknowledgements
Emoji lookup is from @muan's [`emojilib`](https://github.com/muan/emojilib).
Emoji are loaded from a CDN using Twitter's [`twemoji`](https://github.com/twitter/twemoji), which is [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/) licensed. You can get attribution details [on the project page](https://github.com/twitter/twemoji#attribution-requirements).
With apologies, DLM.