-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcelebrate-silliness.qmd
91 lines (69 loc) · 2.19 KB
/
celebrate-silliness.qmd
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
---
title: "silly-wombat"
format: html
---
```{r}
pacman::p_load(OregonTrail, ggChernoff, ggplot2, cowplot, grid, gridExtra, creepr)
```
## Oregon Trail
```{r}
play()
```
## gg_chernoff
https://gist.github.com/baptiste/d4abfa8a6c095d659f8879af5ad9531b
```{r}
load("data/happiness.rda")
happy <- happiness |>
filter(Time == 2016) |>
ggplot(aes(x = GDP, y = Health, smile = Happiness, brow = Corruption)) +
geom_chernoff(aes(fill = Region), size = 10) +
scale_fill_manual(values = c("#fbf8cc", "#fde4cf",
"#ffcfd2", "#f1c0e8", "#cfbaf0", "#a3c4f3", "#90dbf4", "#8eecf5", "#98f5e1", "#b9fbc0")
) +
theme_minimal() +
theme(legend.text = element_text(size=10),
axis.text = element_text(size = 15),
axis.title = element_text(size = 15),
legend.position = "none")
# Extract legend
w_legend <- happiness |>
filter(Time == 2016) |>
ggplot(aes(x = GDP, y = Health, smile = Happiness, brow = Corruption)) +
geom_chernoff(aes(fill = Region), size = 5) +
scale_fill_manual(values = c("#fbf8cc", "#fde4cf",
"#ffcfd2", "#f1c0e8", "#cfbaf0", "#a3c4f3", "#90dbf4", "#8eecf5", "#98f5e1", "#b9fbc0")
) +
theme_minimal() +
theme(legend.text = element_text(size=10),
axis.text = element_text(size = 15),
axis.title = element_text(size = 15),
)
ggsave("output/happy.png", device = "png", width = 8.5, height = 6)
g_legend <- function(a.gplot){
tmp <- ggplot_gtable(ggplot_build(a.gplot))
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
legend <- tmp$grobs[[leg]]
legend
}
legend <- g_legend(w_legend)
grid.newpage()
grid.draw(legend)
```
## Pacman
```{r}
library(remotes)
# Packages required for interactive rendering
remotes::install_github("coolbutuseless/eventloop")
remotes::install_github("coolbutuseless/nara")
install.packages('audio')
# Grab a copy of the pacman game code by cloning the repository
system("git clone https://github.com/coolbutuseless/pacman.git")
# Change into the source code directory and run
setwd('pacman')
source('game.R')
```
## creepr
https://github.com/jcken95/creepr
```{r}
creepr::creepr("strings")
```