ggeasy
ggeasy copied to clipboard
Feature request: `easy_plot_title_face` etc to easily make titles bold
It'd be cool to be able to easily make the title bold etc
easy_plot_title_face(face = NULL, teach = FALSE)
easy_plot_subtitle_face(face = NULL, teach = FALSE)
easy_plot_caption_face(face = NULL, teach = FALSE)
I think we already have this support!
library(ggplot2)
library(ggeasy)
ggplot(mtcars, aes(mpg, hp)) +
geom_point() +
labs(title = "Plot Title in Bold", subtitle = "subtitle in regular font") +
easy_change_text("plot.title", "face", "bold")

ggplot(mtcars, aes(mpg, hp)) +
geom_point() +
labs(title = "Plot Title in regular font", subtitle = "subtitle in bold") +
easy_change_text("plot.subtitle", "face", "bold")

Created on 2023-12-17 with reprex v2.0.2
Oh great, thanks!
Actually, do you think we could have this for just making the plot title bold, as this is a super common thing to have to do?
ggeasy::easy_plot_title_bold()
Having a single function to do this would make it way easier
We could add that, just a simple wrapper of my suggestion above. Maybe a shortcut for italic subtitle. Any others?
Thanks!
Bold title is the only one I would use, I think. I tend to have everything else plain, including the subtitle
Actually ggeasy::easy_plot_title_plain() would be super useful too, as my theme defaults to bold - but sometimes you want it to be plain (e.g. when you are patching plots together)
I think both of these are just straightforward aliases we can define
library(ggplot2)
library(ggeasy)
p <- ggplot(mtcars, aes(mpg, hp)) +
geom_point() +
labs(title = "Plot Title", subtitle = "subtitle")
p

boldp <- p + theme(text = element_text(face = "bold"))
boldp

easy_plot_title_bold <- function() {
easy_change_text("plot.title", "face", "bold")
}
easy_plot_title_plain <- function() {
easy_change_text("plot.title", "face", "plain")
}
p + easy_plot_title_bold()

boldp + easy_plot_title_plain()

Created on 2024-02-01 with reprex v2.0.2
Looks great @jonocarroll
Very very useful :)