-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Themes accept header font family #5887
base: main
Are you sure you want to change the base?
Conversation
I kind of understand why you want to change the inheritance of subtitle and caption but I'm afraid it would throw users off (especially for subtitle). I now regret we didn't name it "description" or something like that |
So should we revert the change in inheritance and manually set the header font to the relevant elements in |
I'm not sure, but I think it would be best at least for subtitle. I'm fine with caption not inheriting from title, I think that was a wrong choice from the start |
After some thought, I think it would be best to have the Example with the current PR, notice the titles remaining sans serif: devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2
p <- ggplot(mpg, aes(displ, hwy)) +
geom_point(aes(colour = class)) +
labs(
title = "Fuel efficiency",
subtitle = "Described for 234 cars from 1999 and 2008.",
caption = "Source: U.S. Environmental Protection Agency",
tag = "A"
) +
theme_gray()
p + theme_gray() +
theme(text = element_text(family = "Times New Roman")) However, this all resolves nicely when the header font is p + theme_gray(header_family = NULL) +
theme(text = element_text(family = "Times New Roman")) Created on 2024-05-21 with reprex v2.1.0 |
Merge branch 'main' into header_family # Conflicts: # R/theme-defaults.R # tests/testthat/test-theme.R
This PR aims to fix #5886.
Briefly, all themes gain a
header_family
argument that defaults tobase_family
. In addition,plot.subtitle
andplot.caption
no longer inherit fromtitle
but the roottext
element to follow #5886 (comment).A demonstration:
Created on 2024-05-10 with reprex v2.1.0