0

I came across many topic for increasing subtitle fonts but none addresses my question. I want to increase the font size of the subtitle (i.e., 2011, 2014 etc) of each graph. These subtitles are added automatically as they are part of my data.frame (and I used facet function to use the Year column). I have tried a few different things but none worked. here is a sample code that would produce the attached graph. enter image description here

ggplot(map_and_data)+ 
  geom_sf(aes(fill=SPEI))+
  facet_wrap(~ Year)+
scale_fill_gradient(low = "yellow", high = "blue")+
  theme_bw()+
  theme(axis.text = element_text(size=14), plot.subtitle = element_text(size = 20))+ 
  theme(legend.position = "bottom", legend.title = element_blank(), legend.key.width = unit(3,"cm"), legend.text = element_text(size=18))

the plot.subtitle did not work.

CForClimate
  • 335
  • 5
  • 19
  • Use `strip.text`. (Looked at `?theme`, searched for "facet", found this described as "facet labels") – Gregor Thomas Apr 29 '19 at 17:36
  • So you can do `theme(strip.text = element_text(size = 20))` – Gregor Thomas Apr 29 '19 at 17:38
  • did you try using "plot.title = theme_text(size = 25)" or "plot.title = element_text(size = 20)"? I think you've mistaken subtitle for title – Lucca Ramalho Apr 29 '19 at 17:40
  • It worked. Thank you@Gregor – CForClimate Apr 29 '19 at 17:43
  • @Gregor, A follow up question on this, how one would standardized the color scheme. In the figure, the color scheme changes with respect to fill values of SPEI. I want to fix the color scheme irrespective of the values. For example Yellow would vary between -2 to -1 (high yellow to light yellow). Similarly 1 to 2 for light blue to dark blue. I tired adding ` scale_fill_gradient(low = "yellow", high = "blue", breaks=c(-2.0, -1, 0, 1, 2), labels= c("Extremely dry", "Dry", "Normal", "Wet", "Extremely wet")) ` to the above code but it did not standardized the scheme. – CForClimate May 01 '19 at 19:25
  • Ask a new a question. Preferably one that's reproducible (using built-in data, or share some sample data). The code in your comment looks to me like it should work, but I can't test or troubleshoot because I don't have sample data. – Gregor Thomas May 02 '19 at 18:19

0 Answers0