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

(Potential) bug with theme within guide_* call #6102

Closed
kylebutts opened this issue Sep 12, 2024 · 1 comment
Closed

(Potential) bug with theme within guide_* call #6102

kylebutts opened this issue Sep 12, 2024 · 1 comment

Comments

@kylebutts
Copy link

kylebutts commented Sep 12, 2024

It is very possible that I'm misunderstanding how to use the theme object within guide_*, but applying themes does not seem to work for me. I am using the most recent development version of ggplot2.

Edit: After some more testing, only the legend.x options are not working

library(ggplot2)
ggplot() +
  geom_point(
    aes(x = mpg, y = hp, color = as.factor(cyl)),
    data = mtcars
  ) +
  scale_color_manual(
    values = c("red", "blue", "green"),
    guide = guide_legend(
      theme = theme(legend.position = "bottom")
    )
  )

ggplot() +
  geom_point(
    aes(x = mpg, y = hp, color = as.factor(cyl)),
    data = mtcars
  ) +
  scale_color_manual(
    values = c("red", "blue", "green"),
    guide = guide_legend()
  ) +
  theme(legend.position = "bottom")

Created on 2024-09-12 with reprex v2.1.0

@teunbrand
Copy link
Collaborator

Thanks for the report!
The issue mirrors #5712 (comment) very closely, so I'll close the discussion here in favour of that issue.
In any case; it is not a bug, but ggplot2 should probably do a better job at making clear which theme elements are in scope and which ones aren't.

@teunbrand teunbrand closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 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
Development

No branches or pull requests

2 participants