Trouble with `ggplot2` not rendering my custom theme correctly in R 4.2.1
I'm not sure how to approach I'm working on a project and hit a roadblock. I'm trying to create a custom theme for my `ggplot2` visualizations in R version 4.2.1, but it doesn't seem to apply correctly when I add it to my plots. I defined a simple theme as follows: ```r custom_theme <- function() { theme_minimal() + theme( plot.title = element_text(hjust = 0.5, size = 20, face = 'bold'), axis.title.x = element_text(size = 14), axis.title.y = element_text(size = 14) ) } ``` When I apply this theme to a basic scatter plot, I run into issues where the title aligns to the left instead of centered, and the size of the axis titles doesnβt seem to change. Here's the code I used to create the plot: ```r library(ggplot2) data(mtcars) ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() + ggtitle('Miles per Gallon vs. Weight') + custom_theme() ``` Despite including `custom_theme()` at the end of my plot code, the output is not reflecting my customizations. Additionally, I used `theme_set()` to set my custom theme as the default: ```r theme_set(custom_theme()) ``` But it still doesn't seem to take effect in subsequent plots either. Iβve tried restarting my R session and reloading the `ggplot2` library but nothing changes. I also checked that my `ggplot2` package is updated to version 3.3.5. Any ideas on what might be going wrong or how to properly set a theme in `ggplot2`? How would you solve this? Hoping someone can shed some light on this.