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

Docs for discrete_scale inaccurate #2052

alistaire47 opened this Issue Feb 22, 2017 · 2 comments


None yet
2 participants

alistaire47 commented Feb 22, 2017

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?


This comment has been minimized.


hadley commented Feb 23, 2017

A PR would be handy. It'll be needed for #1750 too.


This comment has been minimized.


hadley commented Feb 27, 2017

Oooh, if you were interested in a few more docs tweaks, I think an partial fix for #1750 would be to use the new @inheritDots from the latest version of roxygen2.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.