Skip to content

Commit

Permalink
Fix typos in the vignette (#6198)
Browse files Browse the repository at this point in the history
* Fix typos in the vignette.

* Fix two other typos.
  • Loading branch information
mcol authored Nov 25, 2024
1 parent f468053 commit 083a17d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vignettes/articles/faq-annotation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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"`.

<details>

Expand Down
6 changes: 3 additions & 3 deletions vignettes/articles/faq-axes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion vignettes/articles/faq-reordering.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 083a17d

Please sign in to comment.