-
Notifications
You must be signed in to change notification settings - Fork 18
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
new_scale_colour does not work with a scale_* function that includes a guide argument #58
Comments
This is using the DEV version of ggplot2 and ggnewscale Fantastic package btw :) |
If I put the guides arguments as a seperate layer instead of from within the scale function, then it allows the new_scale_color layer but creates problems with the legend by ignoring the initial colour scale guide arguments. library(tidyverse)
#> Warning: package 'purrr' was built under R version 4.3.1
#> Warning: package 'dplyr' was built under R version 4.3.1
library(palmerpenguins)
library(ggnewscale)
d <- penguins |>
group_by(sex, species) |>
summarise(across(flipper_length_mm, \(x) mean(x, na.rm = TRUE))) |>
tidyr::drop_na(sex) |>
mutate(species = stringr::str_to_sentence(species))
#> `summarise()` has grouped output by 'sex'. You can override using the `.groups`
#> argument.
d |>
ggplot(aes(y = flipper_length_mm, x = sex, colour = species, fill = species)) +
geom_col(position = "dodge", width = 0.75, alpha = 0.8) +
scale_colour_manual(values = c("lightgrey", "darkblue", "orange"),
aesthetics = c("colour", "fill")) +
guides(colour = ggplot2::guide_legend(reverse = TRUE, title.position = "top"),
fill = ggplot2::guide_legend(reverse = TRUE, title.position = "top")) +
new_scale_color() Created on 2023-09-06 with reprex v2.0.2 |
I assume that this relates to this?? |
Yes, that PR fixed this issue. |
Created on 2023-09-05 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: