Skip to contents

Overview

This vignette demonstrates how to use the text2map.theme package to customize plot aesthetics, including color palettes and fonts.

Palette Configuration

text2map.theme includes three pre-defined palette options designed for both digital display and print. This setting applies globally to all subsequent ggplot plots.

# Default: Perceptually uniform (best for digital/accessibility)
text2map.theme::set_theme(palette = "viridis")

# Grayscale: Best for textbook printing
text2map.theme::set_theme(palette = "grayscale")

# Warm Gray: Softer alternative for print
text2map.theme::set_theme(palette = "warm_gray")

Font Configuration

The package bundles Open Sans and Lato fonts for offline use. To enable these, set set_font = TRUE.

# Use Lato instead of default Open Sans
text2map.theme::set_theme(set_font = TRUE, base_family = "Lato")

# Use 'extrafont' for legacy support (showtext is default/recommended)
text2map.theme::set_theme(set_font = TRUE, font_method = "extrafont")

Minimal Combined Example

# Combine palette and font settings
# set_font = FALSE prevents issues in restricted build environments
text2map.theme::set_theme(
  palette = "grayscale", 
  set_font = FALSE 
)

# Create a plot
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
  geom_point(size = 3) +
  labs(title = "Iris Sepal Dimensions", subtitle = "Using Grayscale Palette")