Skip to content

Instantly share code, notes, and snippets.

@slowkow
Created April 3, 2024 18:38
Show Gist options
  • Save slowkow/e31471b3dac1792364e6fafaef81dc1e to your computer and use it in GitHub Desktop.
Save slowkow/e31471b3dac1792364e6fafaef81dc1e to your computer and use it in GitHub Desktop.
Default color, fill, and theme settings for ggplot2
# ~/.Rprofile
ggplot2_discrete_pals <- list(
"tol" = c(
"#77AADD", "#EE8866", "#EEDD88", "#FFAABB", "#99DDFF", "#44BB99",
"#BBCC33", "#AAAA00"
),
"okabe" = c(
"#E69F00", "#56B4E9", "#009E73", "#F5C710", "#0072B2", "#D55E00",
"#CC79A7", "#999999", "#000000"
),
"mpn65" = c(
'#ff0029', '#377eb8', '#66a61e', '#984ea3', '#00d2d5', '#ff7f00', '#af8d00',
'#7f80cd', '#b3e900', '#c42e60', '#a65628', '#f781bf', '#8dd3c7', '#bebada',
'#fb8072', '#80b1d3', '#fdb462', '#fccde5', '#bc80bd', '#ffed6f', '#c4eaff',
'#cf8c00', '#1b9e77', '#d95f02', '#e7298a', '#e6ab02', '#a6761d', '#0097ff',
'#00d067', '#000000', '#252525', '#525252', '#737373', '#969696', '#bdbdbd',
'#f43600', '#4ba93b', '#5779bb', '#927acc', '#97ee3f', '#bf3947', '#9f5b00',
'#f48758', '#8caed6', '#f2b94f', '#eff26e', '#e43872', '#d9b100', '#9d7a00',
'#698cff', '#d9d9d9', '#00d27e', '#d06800', '#009f82', '#c49200', '#cbe8ff',
'#fecddf', '#c27eb6', '#8cd2ce', '#c4b8d9', '#f883b0', '#a49100', '#f48800',
'#27d0df', '#a04a9b'
)
)
options(
width = 100,
max.print = 500,
repos = c(CRAN = "https://cran.rstudio.com/"),
ggplot2.discrete.colour = ggplot2_discrete_pals,
ggplot2.discrete.fill = ggplot2_discrete_pals,
ggplot2.continuous.colour = function() { scico::scale_colour_scico(palette = "batlow", direction = -1) },
ggplot2.continuous.fill = function() { scico::scale_fill_scico(palette = "batlow", direction = -1) }
)
ggplot2::theme_set(ggplot2::theme_bw(base_size = 24))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment