Skip to content

Instantly share code, notes, and snippets.

@ikashnitsky
Created January 3, 2023 10:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikashnitsky/653e1040a07364ae82b1bb312501a184 to your computer and use it in GitHub Desktop.
Save ikashnitsky/653e1040a07364ae82b1bb312501a184 to your computer and use it in GitHub Desktop.
theme_ik() – my custom ggplot2 theme that fits the style of my blog – https://ikashnitsky.github.io/2022/exceptional-world-cup
#===============================================================================
# 2023-01-03 -- ik-q
# My custom ggplot2 theme
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com, @ikashnitsky
#===============================================================================
library(ggplot2)
theme_ik <- function(
base_size = 12,
base_family = "sans",
labs_color = "#074949",
axis_color = "#002F2F",
bg_color = "#eeffff",
grid_color = "#ccffff"
){
theme_minimal(base_size = base_size, base_family = base_family)+
theme(
plot.title = element_text(size = base_size*2, face = 2, color = labs_color),
plot.subtitle = element_text(color = labs_color),
plot.caption = element_text(color = labs_color),
axis.title = element_text(color = axis_color),
axis.text = element_text(color = axis_color),
plot.background = element_rect(color = NA, fill = bg_color),
legend.position = "bottom",
panel.spacing = unit(1, "lines"),
panel.grid.major = element_line(color = grid_color),
panel.grid.minor = element_blank(),
line = element_line(lineend = "round")
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment