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

theme_classic() panel grid should be set blank at parent #6320

Open
teunbrand opened this issue Feb 5, 2025 · 0 comments · May be fixed by #6321
Open

theme_classic() panel grid should be set blank at parent #6320

teunbrand opened this issue Feb 5, 2025 · 0 comments · May be fixed by #6321

Comments

@teunbrand
Copy link
Collaborator

This was brought to my attention by @EvaMaeRey. Currently, we have the following situation where we cannot easily switch on the grid in theme_classic(). In the plot below, we would expect green gridlines.

library(ggplot2)

p <- ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  theme_classic()

p + theme(panel.grid = element_line(colour = "limegreen"))

Created on 2025-02-05 with reprex v2.1.1

This is because theem_classic() sets the child elements to blank:

ggplot2/R/theme-defaults.R

Lines 499 to 500 in b87a6e3

panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),

Whereas it would make more sense to set the parent panel.grid to blank and let child elements inherit the usual route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant