Read the data from part 1
gender_gap_in_average_wages_ilo <-
read_csv(here::here("~/Documents/bus320/_posts/2022-05-10-project-part-1/gender-gap-in-average-wages-ilo.csv")) %>%
rename(genderwagegap= 4) %>%
filter(Entity %in% c("Norway", "Peru", "France", "Greece"))
Ineractive graph
- start with the data
- group_by region so there will be a “river” for each region
- Use mutate to round Wagegap so only 2 digits will be displayed when you hover over it.
- Use e_charts to create an e_chart object with with a year on the x-axis
- Use e_river to build “rivers” that contains Wagegap by region. The depth of each river represents the amount of emissions for each region
- Use e_tooltip to add a tooltip to add a tooltip that will display based on the axis values
- Use e_title to add a tittle, subtitle and link to subtitle
- Use e_theme to change the theme to roma.
static graph
start with data
- Use ggplot to create a new ggplot objective use aes to indicate that year will be mapped to the x axis wage gap will be mapped to the y axis
- Region will be fill variable
- Geom_area will display wage gap
- Scale_fill_discrete_divergingx is a function in the colorspace package. It sets the color palette to roma and select a maximum of 12 colors for the different region
- Theme_classic set the theme
- Theme(legend.position = “bottom”) put the legend at the bottom of the plot
- Labs set the y axis label, fill = NULL indicate that the fill variable will not have the labelled region.
- These plots show a steady increase in wages gaps since 2000s, Wage gaps continue to increase in regions.
ggsave(filename = here::here("_posts/2022-05-17-project-2/preview.png"))