Skip to content

scale_colour_discrete not showing an example that uses the function #4910

Closed

Description

@stefanoborini

scale_colour_discrete documentation

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

does not show an actual example containing scale_colour discrete.

Activity

  1. yutannihilation commented on Jul 19, 2022

    @yutannihilation
    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?

  2. gavinsimpson commented on Jun 15, 2023

    @gavinsimpson

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions