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

scale_colour_discrete not showing an example that uses the function #4910

Open
stefanoborini opened this issue Jul 18, 2022 · 2 comments
Open

Comments

@stefanoborini
Copy link

scale_colour_discrete documentation

https://ggplot2.tidyverse.org/reference/scale_colour_discrete.html

does not show an actual example containing scale_colour discrete.

@yutannihilation
Copy link
Member

As scale_colour_discrete() is the default discrete colour scale, the document shows what the user can do on the default scale. I don't think the documentation is bad. But, it might be nice if it can include how to use scale_colour_discrete() itself. Do you see any particular topic missing there?

@gavinsimpson
Copy link

gavinsimpson commented Jun 15, 2023

The examples in the documentation are great if you understand how withr works and grok what's going on with the template function with all the embracing/NSE. The examples are more difficult than they need to be if you do understand these things. The examples are nigh-on-unusable if you don't.

All it needs is a simple example to start that shows actual code a normal user would write, e.g.

# temporarily change the scale to use the Okabe Ito palette
okabe <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442",
    "#0072B2", "#D55E00", "#CC79A7")

ggplot(mpg, aes(cty, colour = class, fill = class)) +
    geom_density(alpha = 0.2) +
    scale_colour_discrete(type = okabe) +
    scale_fill_discrete(type = okabe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants