ggschemes

February 20, 2023 ยท View on GitHub

This package includes additional themes and scales for ggplot2 based on popular color schemes, as well as tools to easily make your own. For a proper introduction, read the package vignette.

Installation

The package is not on CRAN, but you can install it directly from github using

devtools::install_github("kssrr/ggschemes")

Examples

Dracula Dark Horizontal:

ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species, shape = Species)) +
  geom_point(size = 4) +
  theme_dracula_dark_horizontal() +
  scale_color_dracula(palette = "dark") +
  labs(
    title = "Sepal Length vs. Sepal Width", 
    subtitle = "...for Various Species of Iris",
    x = "Sepal Width",
    y = "Sepal Length"
  )

dracula_dark_horizontal

Monokai Dark:

ggplot(mtcars, aes(wt, mpg, color = factor(cyl), shape = factor(cyl))) +
  geom_point(size = 4) +
  theme_monokai_dark() +
  scale_color_monokai(palette = "dark") +
  labs(
    title = "Car Weight vs. Miles per Gallon",
    subtitle = "...and number of cylinders",
    x = "Weight",
    y = "Miles per Gallon",
    color = "Cylinders",
    shape = "Cylinders"
  )
    

monokai_dark

Dracula Light:

ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species, shape = Species)) +
  geom_point(size = 4) +
  theme_dracula_light_horizontal() +
  scale_color_dracula() +
  labs(
    title = "Sepal Length vs. Sepal Width", 
    subtitle = "...for Various Species of Iris",
    x = "Sepal Width",
    y = "Sepal Length"
  )

dracula_light

Gruvbox Light Horizontal:

ggplot(mpg, aes(cty, hwy)) +
    geom_smooth(
      method = "lm", 
      color = gruvbox$light("lightblue"), 
      se = FALSE
    ) +
    geom_count(color = gruvbox$light("red"), show.legend = FALSE) +
    theme_gruvbox_light_horizontal() +
    labs(
      title = "City vs. Highway Mileage",
      subtitle = "...for cars from various manufacturers",
      x = "City mileage",
      y = "Highway mileage",
      n = "Count"
    )

gruvbox_light_horizontal

So far, the package includes three color schemes: Gruvbox, Dracula and Monokai, each with a light and dark variant.