Closed
Description
In the documentation for ?discrete_scale
, the labels
parameter is documented as
NULL
for no labels,waiver()
for default labels (labels the same as breaks), a character vector the same length as breaks, or a named character vector whose names are used to match replacement the labels for matching breaks.
However, in ?scale_x_discrete
, the final example shows a very important alternative: passing a function as a formatter:
# Use abbreviate as a formatter to reduce long names
ggplot(mpg, aes(reorder(manufacturer, displ), cty)) +
geom_point() +
scale_x_discrete(labels = abbreviate)
and thus should probably be documented more like continuous_scale
's labels
parameter:
One of:
- NULL for no labels
- waiver() for the default labels computed by the transformation object
- A character vector giving labels (must be same length as breaks)
- A function that takes the breaks as input and returns labels as output
I'm happy to assemble a quick PR if you like, but will everything get redone in the course of dealing with #1750 anyway?
Metadata
Metadata
Assignees
Labels
No labels