Skip to content

Instantly share code, notes, and snippets.

@wpetry
Last active August 21, 2020 07:32
Show Gist options
  • Save wpetry/900ccf540680ad975e4e6affae1690d4 to your computer and use it in GitHub Desktop.
Save wpetry/900ccf540680ad975e4e6affae1690d4 to your computer and use it in GitHub Desktop.
ggplot2 theme for publication figures
library(ggplot2)
library(grid)
# define consistent ggplot theme to apply to all figures
theme_ms <- function(base_size=12, base_family="Helvetica") {
library(grid)
(theme_bw(base_size = base_size, base_family = base_family)+
theme(text=element_text(color="black"),
axis.title=element_text(face="bold", size = rel(1.3)),
axis.text=element_text(size = rel(1), color = "black"),
legend.title=element_text(face="bold"),
legend.text=element_text(face="bold"),
legend.background=element_rect(fill="transparent"),
legend.key.size = unit(0.8, 'lines'),
panel.border=element_rect(color="black",size=1),
panel.grid=element_blank()
))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment