From dbf58e371123ae5ecd3f83b12ff72ed392212e57 Mon Sep 17 00:00:00 2001 From: Carine Rey <carine.rey@ens-lyon.fr> Date: Tue, 3 Jan 2023 11:40:30 +0100 Subject: [PATCH] add option names in aes --- session_8/session_8.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/session_8/session_8.Rmd b/session_8/session_8.Rmd index ec91ff8..35045b1 100644 --- a/session_8/session_8.Rmd +++ b/session_8/session_8.Rmd @@ -108,7 +108,7 @@ gss_cat %>% By default, `ggplot2` will drop levels that don’t have any values. You can force them to display with: ```{r race_plot, cache = TRUE, fig.width=8, fig.height=4.5, message=FALSE} -ggplot(gss_cat, aes(x=race)) + +ggplot(gss_cat, aes(x = race)) + geom_bar() + scale_x_discrete(drop = FALSE) ``` @@ -166,7 +166,7 @@ ggplot(by_age, aes(x = age, y = prop, colour = marital)) + ``` ```{r fct_reorder2b, cache = TRUE, fig.width=8, fig.height=4.5, message=FALSE} -ggplot(by_age, aes(age, prop, colour = fct_reorder2(marital, age, prop))) + +ggplot(by_age, aes(x = age, y = prop, colour = fct_reorder2(marital, age, prop))) + geom_line() + labs(colour = "marital") ``` -- GitLab