-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathveintiseis.R
80 lines (66 loc) · 1.89 KB
/
veintiseis.R
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
# #30díasdegráficos día 26
# Visualización Digimon
# https://www.kaggle.com/rtatman/digidb
# Autora: Stephanie Orellana (@sporella)
# Cargar librerías --------------------------------------------------------
library(tidyverse)
library(janitor)
library(extrafont)
library(ggmosaic)
library(ggimage)
library(ggthemes)
# loadfonts()
# Cargar y procesar datos -------------------------------------------------
data <- read_csv("data/digimon.csv") %>%
clean_names()
# Visualización -----------------------------------------------------------
p <- ggplot(data = data) +
geom_mosaic(aes(x = product(attribute), fill = type),
colour = "black",
show.legend = F) +
labs(
x = "Atributo",
y = "Tipo",
title = "DIGIMON",
subtitle = "Tipos v/s Atributos",
caption = "@sporella"
) +
scale_fill_manual(values = c("#abfff5",
"#fcb9da",
"#fffac7",
"#ada9b9")) +
theme_clean() +
theme(
text = element_text(
face = "bold",
family = "Bahnschrift",
colour = "#de9be8"
),
plot.title = element_text(hjust = 0.5, size = 40),
plot.subtitle = element_text(hjust = 0.5, size = 20),
axis.text.x = element_text(
face = "bold",
size = 12,
colour = "#de9be8"
),
axis.text.y = element_text(
face = "bold",
size = 12,
colour = "#de9be8"
),
axis.title.x = element_text(hjust = 0, size = 10),
axis.title.y = element_text(hjust = 0, size = 10),
panel.grid.major.x = element_line(
size = 1,
linetype = "dotted",
colour = "grey90"
),
panel.grid.major.y = element_line(
size = 1,
linetype = "dotted",
colour = "grey90"
)
)
back <- "img/digimon.png"
pi <- ggimage::ggbackground(p, back)
ggsave("plots/veintiseis/digimon.png", pi, width = 8, height = 5.5)