Text insertion and arguments update/alignment (#1232)

This commit is contained in:
Stephen Balogun 2023-01-20 14:55:35 +01:00 committed by GitHub
parent 1d7fef794a
commit a7815c9220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -376,7 +376,7 @@ For example, let's explore how the price of a diamond varies with its quality (m
#| Ideal diamonds have the highest peak around 1500.
ggplot(diamonds, aes(x = price)) +
geom_freqpoly(aes(color = cut), binwidth = 500, size = 0.75)
geom_freqpoly(aes(color = cut), binwidth = 500, linewidth = 0.75)
```
The default appearance of `geom_freqpoly()` is not that useful for that sort of comparison because the height is given by the count and the overall counts of `cut` in differ so much, making it hard to see the differences in the shapes of their distributions:
@ -404,7 +404,7 @@ Instead of displaying count, we'll display the **density**, which is the count s
#| around a price of 1500 and Fair diamonds have a higher mean than others.
ggplot(diamonds, aes(x = price, y = after_stat(density))) +
geom_freqpoly(aes(color = cut), binwidth = 500, size = 0.75)
geom_freqpoly(aes(color = cut), binwidth = 500, linewidth = 0.75)
```
Note that we're mapping the density the `y`, but since `density` is not a variable in the `diamonds` dataset, we need to first calculate it.

View File

@ -841,7 +841,7 @@ mpg |>
You can also set the `limits` on individual scales.
Reducing the limits is basically equivalent to subsetting the data.
It is generally more useful if you want *expand* the limits, for example, to match scales across different plots.
It is generally more useful if you want to *expand* the limits, for example, to match scales across different plots.
For example, if we extract two classes of cars and plot them separately, it's difficult to compare the plots because all three scales (the x-axis, the y-axis, and the color aesthetic) have different ranges.
```{r}
@ -1098,7 +1098,7 @@ p5 <- ggplot(mpg, aes(x = cty, y = hwy, color = drv)) +
guides = "collect",
heights = c(1, 3, 2, 4)
) &
theme(legend.position = "bottom")
theme(legend.position = "top")
```
If you'd like to learn more about combining and layout out multiple plots with patchwork, we recommend looking through the guides on the package website: <https://patchwork.data-imaginist.com>.