Skip to content

Instantly share code, notes, and snippets.

@timedreamer
Last active March 17, 2021 14:34
Show Gist options
  • Save timedreamer/29bec34c0acb05d643386c3188b17fa8 to your computer and use it in GitHub Desktop.
Save timedreamer/29bec34c0acb05d643386c3188b17fa8 to your computer and use it in GitHub Desktop.
The ggplot theme I updated based on theme_bw().
library(ggplot2)
theme_jh <- function (base_size = 11, base_family = "Arial",
base_line_size = base_size/22,
base_rect_size = base_size/22) {
theme_grey(base_size = base_size, base_family = base_family,
base_line_size = base_line_size,
base_rect_size = base_rect_size) +
theme(panel.background = element_rect(fill = "white", colour = NA),
panel.border = element_rect(fill = NA, colour = "grey20"),
panel.grid = element_line(colour = "grey92"),
panel.grid.minor = element_line(size = rel(0.5)),
strip.background = element_rect(fill = "grey85", colour = "grey20"),
legend.key = element_rect(fill = "white", colour = NA), complete = TRUE) +
# above is just theme_bw(). Below are my updates.
theme(axis.text=element_text(size=14),
axis.title=element_text(size=14,face="bold"),
strip.text = element_text(size = 14),
plot.title = element_text(size = 14, hjust = 0.5),
legend.text = element_text(size = 14, face = "bold"),
legend.title=element_text(size=16),
panel.grid.minor = element_blank())
}
@timedreamer
Copy link
Author

To use, just get the URL from Raw. And add source(RAW_URL) in your R script and you are good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment