-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04_Plotting.Rmd
96 lines (55 loc) · 1.81 KB
/
04_Plotting.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
---
title: "Plotting"
author: "| Rodrigo Esteves de Lima-Lopes \n| University of Campinas \n| [email protected]\n"
output:
md_document:
variant: markdown_github
html_document:
toc: yes
pdf_document:
toc: yes
number_sections: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Introduction
This script was developed for the analysis of Portuguese. I hope it helps colleagues in the LC area and popularize the use of R. It is part of our research project developed with CNPQ. Please drop me a line if you have any doubts or need any help.
# Purpose of this repository
This git brings the scripts for my article:
- Lima-Lopes R.E. (forthcoming). Beyond the Binary: Trans Women's Video Activism on YouTube. Accepted for publication at *Digital Scholarship in the Humanities*.
This script is specifically about **plotting**.
# Packages
For data processing we are going to need some packages:
```{r packages, eval=FALSE}
library(dbplyr)
library(ggplot)
library(ggridges)
```
# Plotting
Definig the color and ploting graph 1
```{r graph1, eval=FALSE}
colour <-"bisque4"
df_topics %>%
count(topic) %>%
mutate(topic = forcats::fct_reorder(topic, n)) %>%
ggplot(aes(x = topic, y = n)) +
geom_col(fill = colour) +
theme_minimal() +
labs(x = "Topics", y = "Videos",
title = NULL) +
coord_flip()
```
Definig the color and ploting graph 2
```{r graph2, eval=FALSE}
df_topics$channel <-as.factor(df_topics$channel)
df_topics$topic <- as.factor(df_topics$topic)
xtabs(~ channel + topic, df_topics) %>%
as.data.frame() %>%
ggplot(aes(channel, topic)) +
geom_tile(aes(fill = Freq)) +
scale_fill_gradient(low="#D6D2C4", high="#575257")+
geom_text(aes(label = round(Freq, 1))) +
labs(x = "Channels", y = "Topics",
title = NULL)
```