From 934b1468a4303bdcc14a78d50b70823cae85a45a Mon Sep 17 00:00:00 2001 From: 0c2d387b484b42dc06d4c28dcae352b6 <0c2d387b484b42dc06d4c28dcae352b6@app-learninglab.inria.fr> Date: Wed, 1 Dec 2021 12:34:03 +0000 Subject: [PATCH] Replace exercice_en.Rmd --- module3/exo3/exercice_en.Rmd | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/module3/exo3/exercice_en.Rmd b/module3/exo3/exercice_en.Rmd index d16c816..c223ee5 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 + -- 2.18.1