Add waffle

This commit is contained in:
gnoblet 2023-05-29 10:47:36 +02:00
parent b8b50b09b2
commit 09ef523c64

View file

@ -128,6 +128,7 @@ df <- tibble::tibble(
dplyr::mutate(stat = round(stat, 0))
# Example, adding a parameter to `theme_reach()` passed on `ggplot2::theme()` to align legend title
dumbbell(df,
stat,
setting,
@ -170,18 +171,15 @@ donut(df,
theme = theme_reach(legend_reverse = TRUE))
```
### Example 4: donut chart, REACH themed (to used once, not twice)
```{r example-donut-plot, out.width = "65%", warning = FALSE}
# Donut
waffle(df,
status,
percentage,
title = "% of HHs by displacement status",
theme = theme_reach(legend_reverse = TRUE))
### Example 5: waffle chart
```{r example-waffle-plot, out.width = "65%", warning = FALSE}
#
waffle(df, status, percentage, x_title = "A caption", title = "A title", subtitle = "A subtitle")
```
### Example 5: alluvial chart, REACH themed
### Example 6: alluvial chart, REACH themed
```{r example-alluvial-plot, out.width = "65%", warning = FALSE}
# Some summarized data: % of HHs by self-reported status of displacement in 2021 and in 2022
@ -211,7 +209,7 @@ alluvial(df,
```
### Example 6: lollipop chart
### Example 7: lollipop chart
```{r example-lollipop-chart, out.width = "65%", warning = FALSE}
library(tidyr)
# Prepare long data