README.md

BensThemes

GitHub
license

A package for R that contains the custom themes I use for ggplot2. This was made for my own personal use but if you would also like to use these themes follow the steps below.

Installation

This project is not on CRAN so to download you will need to have the package devtools for R.

devtools::install_github("benchaffe/BensThemes")

To use the fonts you may also need the package extrafont. Simply follow the steps below.

library(extrafont)
font_import()
loadfonts(device = "win")

font_import() can take around 5 minutes.

Themes

Examples

Note: all themes have the option axisLabels = TRUE by default. Simply set to false to hide axis labels.

Light Gray Theme

ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(title = "Scatterplot of mtcars data", 
       subtitle = "An example subtitle", 
       caption = "BensThemes") +
  theme_belightgray()

White Theme

ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(title = "Scatterplot of mtcars data", 
       subtitle = "An example subtitle", 
       caption = "BensThemes") +
  theme_bewhite()

Blue Theme

ggplot(mtcars, aes(mpg, wt)) +
  geom_point(color = "white") +
  labs(title = "Scatterplot of mtcars data", 
       subtitle = "An example subtitle", 
       caption = "BensThemes") +
  theme_beblue()

Dark Theme

ggplot(mtcars, aes(mpg, wt)) +
  geom_point(color = rgb(255, 235, 30, maxColorValue = 255, alpha = 255)) +
  labs(title = "Scatterplot of mtcars data",
       subtitle = "An example subtitle",
       caption = "BensThemes") +
  theme_bedark()

Dark-ish Theme

ggplot(mtcars, aes(mpg, wt)) +
  geom_point(color = rgb(255, 235, 30, maxColorValue = 255, alpha = 255)) +
  labs(title = "Scatterplot of mtcars data",
       subtitle = "An example subtitle",
       caption = "BensThemes") +
  theme_bedarkish()

Retro Theme

ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(title = "Scatterplot of mtcars data",
       subtitle = "An example subtitle",
       caption = "BensThemes") +
  theme_beretro()



benchaffe/BensThemes documentation built on March 12, 2021, 4:11 a.m.