suezalla: A custom ggplot2 theme and colour palette

suezalla is a lightweight R package that provides:

  • Custom ggplot2 themes: theme_magazine(), theme_latex(), theme_zombie(), theme_academic1940(), and theme_academic1940_pattern()
  • Several curated colour palettes inspired by polaroids, jam jars, retro aesthetics, zombies, and classic scientific graphics
  • Pattern fill utilities for ggpattern, including suezalla_academic_style()
  • Custom scale functions: scale_colour_suezalla() and scale_fill_suezalla()

These tools help you create clean, consistent, or stylistically bold visualizations with minimal effort.


Installation

Install the development version of suezalla from GitHub using devtools:

# If not already installed
install.packages("devtools")

# Install suezalla
devtools::install_github("sucanavan/suezalla")

Available palettes

The suezalla package includes several curated colour palettes that you can use in your plots. Below is a visual preview of each palette:

Note: The npg palette is based on the Nature Publishing Group (NPG) color scheme as provided by the ggsci package.

Palette Colours
polaroid
vibrant
jam
corporate
lively1
lively2
retro
autumn
zombie
academic
npg

Using palettes in code

To extract colours programmatically from a palette, use the suezalla_palette() function.

Arguments:

  • palette_name: The name of the palette you want to use, such as "jam" or "autumn".
  • n: The number of colours to return.
  • type: "discrete" for exact colours or "continuous" for a smooth gradient (interpolated).

Examples:

# Return 4 discrete colours from the 'jam' palette
suezalla_palette("jam", n = 4)
## [1] "#FBC9BE" "#DB7B65" "#ECB865" "#695356"
# Return 10 interpolated colours from the 'autumn' palette as a gradient
suezalla_palette("autumn", n = 10, type = "continuous")
##  [1] "#388388" "#42A4A5" "#51BDB5" "#74B592" "#9FB578" "#D3BF6E" "#ECB867"
##  [8] "#F2A562" "#EE8B59" "#E76F51"

Fonts

The suezalla package auto-loads:

  • Roboto from Google Fonts for theme_suezalla()
  • XKCD (if available locally) for theme_zombie()
  • Abhaya Libre, Latin Modern Roman, and CMU Serif for academic themes

These are handled automatically via sysfonts and showtext when the package is attached.


Quick examples

LaTeX academic plot

This plot uses theme_latex(), a clean black-and-white theme with a serif font designed to resemble LaTeX-style figures. It is ideal for academic publications with strict formatting requirements.

ggplot(mtcars, aes(x = mpg, y = wt, shape = factor(carb))) +
  geom_point(size = 2, stroke = 0.4) +
  theme_latex() +
  labs(
    title = "Car efficiency by weight",
    x = "Miles per Gallon",
    y = "Weight",
    shape = "Carburetors"
  )

Academic 1940

This example applies theme_academic1940(), inspired by mid-20th-century scientific plots. It uses black outlines, serif fonts, and simple geometry to evoke a retro academic aesthetic.

ggplot(mtcars, aes(x = mpg, y = wt, shape = factor(carb))) +
  geom_point(size = 2, stroke = 0.4, color = "black", fill = "white") +
  scale_shape_manual(values = c(0, 1, 2, 3, 4, 5)) +
  theme_academic1940() +
  labs(
    title = "Car efficiency by weight",
    x = "Miles per Gallon",
    y = "Weight (1000 lbs)",
    shape = "Carburetors"
  )

Academic pattern style

This example demonstrates theme_academic1940_pattern(), designed for black-and-white print or accessibility needs. It uses shape patterns (via ggpattern) instead of color fills.

df <- aggregate(wt ~ cyl, data = mtcars, FUN = mean)
df$cyl <- factor(df$cyl)

ggplot(df, aes(x = cyl, y = wt, fill = cyl, pattern = cyl)) +
  theme_academic1940_pattern(n = 3)

Magazine theme

The theme_magazine() style is designed for modern visuals with a bold font and clean grid-free layout. Combined with the corporate color palette, it gives a contemporary data journalism vibe.

ggplot(mtcars, aes(x = wt, y = mpg, colour = factor(cyl))) +
  geom_point(size = 3) +
  scale_colour_suezalla(palette_name = "corporate") +
  theme_magazine() +
  theme(
    axis.ticks = element_line(size = 0.3),
    axis.ticks.length = unit(3, "pt")
  ) +
  labs(
    title = "Car efficiency by weight",
    x = "Weight",
    y = "Miles per Gallon",
    colour = "Cylinders"
  )

Zombie theme

A playful and gritty theme (theme_zombie()) with a hand-drawn feel, using the XKCD font if available. Intended for creative or informal visualizations.

ggplot(mtcars, aes(y = wt, x = mpg)) + 
  geom_point(aes(fill = factor(cyl), size = cyl), shape = 21, alpha = 0.8) + 
  scale_fill_suezalla(palette_name = "zombie") + 
  theme_zombie() +
  labs(
    title = "Car efficiency by weight",
    x = "Weight",
    y = "Miles per Gallon",
    colour = "Cylinders"
  )