diff --git a/module3/exo3/exercice_en.Rmd b/module3/exo3/exercice_en.Rmd index d16c816743174292220b1c9c855257e45449116f..c223ee5144a44bb015a471d97d9b5e8a3f6f0d0b 100644 --- a/module3/exo3/exercice_en.Rmd +++ b/module3/exo3/exercice_en.Rmd @@ -45,8 +45,8 @@ df <- df[c(2:4)] df[c(1,2),] ``` -## Reproducing Playfair's graph -**!!TODO : perform required transformations in terms of wheat-price & salary** +## 1. Reproducing Playfair's graph + ```{r, message=FALSE} # create a list of colors my_colors <- list( blue = "#3399e6", @@ -65,9 +65,9 @@ ggplot(df, aes(x=Year)) + # Custom the Y scales: scale_y_continuous( # Features of the first axis - name = "Wages", + name = "Wages (in Shillings per week)", # Add a second axis and specify its features - sec.axis = sec_axis( trans=~.*1.5, name="Wheat Price") + sec.axis = sec_axis( trans=~.*1.5, name="Wheat Price (in Shillings per quarter)") ) + labs(title = "Evolution of wages and wheat price for English workers (16th to 19th century)") + theme(plot.title = element_text(hjust = 0.5), @@ -75,7 +75,7 @@ ggplot(df, aes(x=Year)) + axis.title.y.right = element_text(colour = my_colors[["dark"]])) ``` -## Alternative representation +## 2. Alternative representation First, we represent the data as simple dots for both wages and wheat price. As it is difficult to see the pattern for the wheat values evolution, we use the `stat_smooth()` function that shows a smoothed mean. @@ -96,10 +96,10 @@ ggplot(df, aes(x=Year)) + # Custom the Y scales: scale_y_continuous( # Features of the first axis - name = "Wages", + name = "Wages (in Shillings per week)", # Add a second axis and specify its features - sec.axis = sec_axis( trans=~.*1.5, name="Wheat") + sec.axis = sec_axis( trans=~.*1.5, name="Wheat (in Shillings per quarter)") ) + labs(title = "Evolution of wages and wheat price for English workers (16th to 19th century)") + theme(plot.title = element_text(hjust = 0.5), @@ -107,4 +107,7 @@ ggplot(df, aes(x=Year)) + axis.title.y.right = element_text(colour = wheat_color)) ``` +## 3. Another Representation without an explicit time axis +TBD +