From 08a36a259d04729cfb60e74fc0a61ef5589e8867 Mon Sep 17 00:00:00 2001 From: Marco Colombo Date: Sun, 24 Nov 2024 15:48:46 +0100 Subject: [PATCH 1/2] Fix typos in the vignette. --- vignettes/articles/faq-axes.Rmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vignettes/articles/faq-axes.Rmd b/vignettes/articles/faq-axes.Rmd index f37195a84f..cf88240cfa 100644 --- a/vignettes/articles/faq-axes.Rmd +++ b/vignettes/articles/faq-axes.Rmd @@ -69,7 +69,7 @@ ggplot(msleep, aes(y = order, x = sleep_total)) + geom_boxplot() ``` -- Dodge axis labels: Add a `scale_*()` layer, e.g. `scale_x_continuous()`, `scale_y_discrete()`, etc., and customise the `guide` argument with the `guide_axis()` function. In this case we want to customise the x-axis, and the variable on the x-axis is discrete, so we'll use `scale_x_continuous()`. In the `guide` argument we use the `guide_axis()` and specify how many rows to dodge the labels into with `n.dodge`. This is likely a trial-and-error exercise, depending on the lengths of your labels and the width of your plot. In this case we've settled on 3 rows to render the labels. +- Dodge axis labels: Add a `scale_*()` layer, e.g. `scale_x_continuous()`, `scale_y_discrete()`, etc., and customise the `guide` argument with the `guide_axis()` function. In this case we want to customise the x-axis, and the variable on the x-axis is discrete, so we'll use `scale_x_discrete()`. In the `guide` argument we use the `guide_axis()` and specify how many rows to dodge the labels into with `n.dodge`. This is likely a trial-and-error exercise, depending on the lengths of your labels and the width of your plot. In this case we've settled on 3 rows to render the labels. ```{r} #| label: msleep-order-sleep-total-dodge @@ -115,9 +115,9 @@ Suppose we want to remove the axis labels entirely. - Remove x or y axis labels: If you want to modify just one of the axes, you can do so by modifying the components of the `theme()`, setting the elements you want to remove to `element_blank()`. You would replace `x` with `y` for applying the same update to the y-axis. Note the distinction between `axis.title` and `axis.ticks` -- `axis.title` is the name of the variable and `axis.text` is the text accompanying each of the ticks. ```{r} -#| fig.alt: "A boxplot showing the total amount of sleep on the y-axis for 19 +#| fig.alt: "A boxplot showing the total amount of sleep on the y-axis for 19 #| taxonomical orders of mammals on the x-axis. The annotation on the x-axis -#| is abent." +#| is absent." ggplot(msleep, aes(x = order, y = sleep_total)) + geom_boxplot() + theme( From 0f4fe2e340ab38a3c1bb80c1d09347a9b603c47d Mon Sep 17 00:00:00 2001 From: Marco Colombo Date: Sun, 24 Nov 2024 16:02:53 +0100 Subject: [PATCH 2/2] Fix two other typos. --- vignettes/articles/faq-annotation.Rmd | 2 +- vignettes/articles/faq-reordering.Rmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vignettes/articles/faq-annotation.Rmd b/vignettes/articles/faq-annotation.Rmd index a5a5c61f3c..ff382d40b3 100644 --- a/vignettes/articles/faq-annotation.Rmd +++ b/vignettes/articles/faq-annotation.Rmd @@ -206,7 +206,7 @@ mpg %>% ### How can I display proportions (relative frequencies) instead of counts on a bar plot? -Either calculate the proportions ahead of time and place them on bars using `geom_text()` or let `ggplot()` calculate them for you and then add them to the plot using `stat_coun()` with `geom = "text"`. +Either calculate the proportions ahead of time and place them on bars using `geom_text()` or let `ggplot()` calculate them for you and then add them to the plot using `stat_count()` with `geom = "text"`.
diff --git a/vignettes/articles/faq-reordering.Rmd b/vignettes/articles/faq-reordering.Rmd index 3bbc180d6f..964dd6ba08 100644 --- a/vignettes/articles/faq-reordering.Rmd +++ b/vignettes/articles/faq-reordering.Rmd @@ -211,7 +211,7 @@ df <- tibble::tribble( ) ``` -By default, this is how a scatterplot of these looks. +By default, this is how a scatter plot of these looks. Note that the blue circle is partially covered by the yellow triangle since that observation comes later in the dataset. Similarly the black asterisk appears on top of the red square.