The RMarkdown source to this file can be found here
default ggplot themes
One of my favorite aspects of ggplot2 is the use of themes. Not including a theme, the default ggplots theme is the theme_grey which has a dark grey background with white grid lines. See the example below
You see these plots all over the place now and you can recognize the ggplot2 style. The problem with the default theme in ggplot is that these do not work for presentation formats (e.g., publication in a journal or presentation).
There are a couple of “canned” themes that come with ggplot that offer themes do change the way the plot looks without having to edit every aspect of the visual presentation of the plot and these are theme_bw() and theme_grey
Here is an example of both plots using each theme side by side (for this presentation I turned “off” the legend).
While the theme_bw() is an improvment it still does not meet publication quality figures (atleast in my field) or my typical presentation format. So I generated a few other themese that I use on a regular basis to make inclusion of these figures easier. The basic process is fairly straight forward. You start with the theme_bw and modify using %+replace% the aspects you wish to change.
theme_mine
theme_mine is the theme I use most often and is what I generally use for pubs.
theme_presentation
My general format in presentations is to have a black background with white, yellow, and green text. I therefore created a theme (theme_presentation)that would work with the required black background and white text.
theme_map
I do a lot of map creation using ggplot and therefore the canned themes and the previous themes I discussed do not really fit. So I created a theme (theme_map).
These files are included in a single file I call themes.r which I load as a source file in the housekeeping section of my R code. I included this file here, which includes a theme_transparent and a theme_map_presentation that were not discussed above but ones that I use every once in a while. If anyone has another theme or theme ideas I would love to hear about them.
Leave a Comment