Overview
ggastrum provides custom ggplot2 themes and color
palettes designed for academic publications and presentations. The
package includes two themes (theme_t2m() and
theme_solaris()) and five color palettes (solaris, viridis,
inferno, grayscale, doplar).
Quick Start
The simplest way to use the package is with set_theme(),
which configures the global ggplot2 theme and color palette:
# Set up the theme (uses solaris palette by default)
set_theme()
# Create a plot - theme and colors are applied automatically
ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
geom_point(size = 4) +
labs(
title = "Fuel Efficiency by Weight",
x = "Weight (1000 lbs)",
y = "Miles per Gallon",
color = "Cylinders"
)
Solaris Theme
For a warmer aesthetic with a cream-colored background, use
theme_solaris():
ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
geom_point(size = 4) +
scale_color_solaris_d() +
theme_solaris() +
labs(
title = "Fuel Efficiency by Weight",
subtitle = "Solaris theme with cream background",
x = "Weight (1000 lbs)",
y = "Miles per Gallon",
color = "Cylinders"
)
Font Configuration
The package bundles Open Sans, Lato, and Source Sans 3 fonts for
offline use. To enable custom fonts, set
set_font = TRUE:
Learn More
For more detailed documentation, see the following articles:
- Color Palettes: Compare viridis, inferno, grayscale, and solaris palettes for discrete and continuous scales
-
Theme
Comparison: Side-by-side comparison of
theme_t2m()andtheme_solaris(), plus print optimization - Base R Plots: Using text2map.theme palettes with base R graphics
- Network Visualization: Using themes and palettes with ggraph network plots
