R Style Guide

Here's how to make your stuff look good

BLab ggplot theme

Use the blab theme! Do it like this:

library(tidyverse) # loads ggplot
library(viridis) # loads the color palette you should use for accessible figures
remotes::install_github("BergelsonLab/blabr") 
# makes sure your blabr package is up to date
library(blabr) # loads the package

plotname <- ggplot(mpg, aes(x = cyl, y = displ, colour = class)) + 
  geom_jitter(size = 4)+ # making the dots big to match the plot
  scale_colour_viridis(discrete = T) 
  # using the colour palette I think we should use. 
  # discrete = T/F is an important arg.

plotname

plotname + theme_blab() # you can add theme_blab() to any ggplot

ggsave("path/plotname.tiff", bg = "transparent") 
# your figure will have a transparent background if you keep the bg arg. Try it!

Last updated