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

guide_colorsteps() can't set the position #5930

Open
Andtise opened this issue Jun 4, 2024 · 1 comment · May be fixed by #5931
Open

guide_colorsteps() can't set the position #5930

Andtise opened this issue Jun 4, 2024 · 1 comment · May be fixed by #5931
Labels
bug an unexpected problem or unintended behavior guides 📏

Comments

@Andtise
Copy link

Andtise commented Jun 4, 2024

In my use of the newer version of ggplot2 (version3.5.1), I found that I can't set the position for guide_colorstep individually, but only through the global theme's legend.position.

I'm not sure if this is intentional or not, but I think it doesn't follow the logic of guides as a whole. Here's a simple example:

library(ggplot2)

# position not working of guide_colorsteps
p1 <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
  geom_point() +
  guides(color=guide_colorsteps(position = "bottom"))

# position working of guide_colorbar
p2 <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
  geom_point() +
  guides(color=guide_colorbar(position = "bottom"))

# global theme’s legend.position setting
p3 <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
  geom_point() +
  guides(color=guide_colorsteps()) +
  theme(legend.position = "bottom")

patchwork::wrap_plots(p1, p2, p3)

bug

@teunbrand
Copy link
Collaborator

You're right, thanks for catching this!

@teunbrand teunbrand added guides 📏 bug an unexpected problem or unintended behavior labels Jun 4, 2024
@teunbrand teunbrand linked a pull request Jun 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior guides 📏
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants