knitr::opts_chunk$set(
  collapse  = TRUE,
  comment   = "#>",
  fig.path  = "man/figures/README-",
  fig.align = "center",
  out.width = "80%",
  dev       = "ragg_png",
  dpi       = 132
)

myplotdefaults

This is just a repo where I store my plot defaults for the {ggplot2} package. It is in package format so I wouldn't need to repeat it for every script. The theming and such isn't particularly good, noteworthy or quirky, it is just to easily replace the default gray theme with yet another vanilla theme.

Installation

You can install {myplotdefaults} like so:

# install.packages("remotes")
remotes::install_github("teunbrand/myplotdefaults")

Example

This is a basic example which shows you how to solve a common problem:

library(myplotdefaults)
library(ggplot2)

p <- ggplot(mtcars, aes(mpg, disp)) +
  geom_point()

set_defaults()
p + ggtitle("The defaults substitutes black for dark grey")

set_defaults(ink_colour = "blue")
p + ggtitle("Ink colour changes foreground")

set_defaults(ink_colour = "white", paper_colour = "black",
             shadow_colour = "grey10")
p + ggtitle("Paper and shadow colour set background and gridline colours")


teunbrand/myplotdefaults documentation built on Jan. 25, 2023, 7:23 p.m.