Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scales-position.qmd #392

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions scales-position.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ This can often produce clearer plots: in the example above each year is labelled
## Discrete position scales {#sec-discrete-position}

It is also possible to map discrete variables to position scales, with the default scales being `scale_x_discrete()` and `scale_y_discrete()`.
For example, the following two plot specifications are equivalent
For example, the following two plot specifications are equivalent:

```{r}
#| label: default-scales-discrete
Expand Down Expand Up @@ -735,8 +735,7 @@ ggplot(mpg, aes(x = drv, y = hwy)) + geom_boxplot(width = .4)

\index{Axis!labels} \index{Legend!keys}

The limits, breaks.
and labels for a discrete position scale can be set using the `limits`, `breaks`, and `labels` arguments.
The limits, breaks, and labels for a discrete position scale can be set using the `limits`, `breaks`, and `labels` arguments.
For the most part these behave identically to the corresponding arguments for numeric scales (@sec-numeric-position-scales), though there are some differences.
For example, the limits of a discrete scale are not defined in terms of endpoints, but instead correspond to the set of allowable values for that variable.
Accordingly, ggplot2 expects that the `limits` of a discrete scale should be a character vector that enumerates all possible values in the order they should appear:
Expand Down