improve bar plot fraktionen helper

This commit is contained in:
2021-08-03 11:33:24 +02:00
parent 354d18050b
commit e2caf1ff4e
2 changed files with 55 additions and 17 deletions
+13 -10
View File
@@ -55,7 +55,8 @@ join_redner(res$reden, res) %>%
group_by(fraktion) %>%
summarize(n = n()) %>%
arrange(n) %>%
bar_plot_fraktionen(n, fill = fraktion, title="Number of speeches given by fraction", ylab="Number of speeches")
bar_plot_fraktionen(title="Number of speeches given by fraction",
ylab="Number of speeches")
```
or counting the occurences of a given word:
@@ -69,9 +70,9 @@ find_word(res, "Kohleausstieg") %>%
group_by(fraktion) %>%
summarize(n = n()) %>%
arrange(desc(n)) %>%
bar_plot_fraktionen(n, fill = fraktion,
title = "Parties using the word 'Kohleausstieg' the most (absolutely)",
ylab = "Number of uses of 'Kohleausstieg'")
bar_plot_fraktionen(title = "Parties using the word 'Kohleausstieg' the most (absolutely)",
ylab = "Number of uses of 'Kohleausstieg'",
flipped = F)
```
### Who gives the most speeches?
@@ -118,13 +119,14 @@ For plotting our results we reorganize them a bit and produce a bar plot:
```{r, fig.width=7}
pivot_longer(tb, where(is.numeric), "by_fraktion", "count") %>%
filter(!is.na(on_fraktion)) %>%
rename(fraktion = on_fraktion) %>%
bar_plot_fraktionen(value,
bar_plot_fraktionen(x_variable = on_fraktion,
y_variable = value,
fill = by_fraktion,
title = "Number of rounds of applauses from fractions to fractions",
xlab = "Applauded fraction",
ylab = "Rounds of applauses",
filllab = "Applauding fraction")
filllab = "Applauding fraction",
flipped = FALSE)
```
@@ -147,13 +149,14 @@ Analogously we plot the results:
```{r, fig.width=7}
pivot_longer(tb, where(is.numeric), "by_fraktion", "count") %>%
filter(!is.na(on_fraktion)) %>%
rename(fraktion = on_fraktion) %>%
bar_plot_fraktionen(value,
bar_plot_fraktionen(x_variable = on_fraktion,
y_variable = value,
fill = by_fraktion,
title = "Number of comments from fractions to fractions",
xlab = "Commented fraction",
ylab = "Number of comments",
filllab = "Commenting fraction")
filllab = "Commenting fraction",
flipped = FALSE)
```
### When are which topics discussed the most?