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

More palette flexibility #6112

Closed
wants to merge 3 commits into from
Closed

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #6064.
Additionally it would also fix #6068 and fix #5843 and #2851.

The PR is a draft, as the {scales} version that powers this PR is not released yet.
It adds a palette argument to the default discrete/binned/continuous colour/fill scales, which bypasses the .
This palette is then internally converted with as_discrete_pal() or as_continuous_pal().
In the example below, we're using a single palette to populate all 3 types of scales.

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2
packageVersion("scales")
#> [1] '1.3.0.9000'

p <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
  geom_point()

my_pal <- colour_ramp(c("cyan", "deepskyblue", "magenta"))

p + scale_colour_continuous(palette = my_pal)

p + scale_colour_binned(palette = my_pal)

p + scale_colour_discrete(palette = my_pal) +
  aes(colour = drv)

Created on 2024-09-17 with reprex v2.1.1

@teunbrand
Copy link
Collaborator Author

closing this in favour of #6216.

@teunbrand teunbrand closed this Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant