Skip to contents

A minimal theme optimized for icon-based population plots. Similar to theme_void() but with automatic legend key sizing, appropriate margins, and sensible defaults for population visualizations.

Usage

theme_pop(
  base_size = 11,
  base_family = "",
  base_line_size = base_size/22,
  base_rect_size = base_size/22,
  legend_icon_size = NULL,
  legend_spacing = NULL,
  plot_margin = NULL,
  legend_position = "right"
)

Arguments

base_size

Base font size in points (default: 11).

base_family

Base font family (default: "").

base_line_size

Base size for line elements (default: base_size/22).

base_rect_size

Base size for rect elements (default: base_size/22).

legend_icon_size

Size of legend icons in cm. If NULL (default), automatically calculated as base_size/20 for proportional sizing.

legend_spacing

Spacing between legend items in cm (default: 0.3 * legend_icon_size).

plot_margin

Plot margins. Default: margin(5.5, 5.5, 5.5, 5.5, "pt"). Can be a single numeric (applied to all sides) or margin() object.

legend_position

Position of legend: "none", "left", "right", "bottom", "top" (default: "right").

Value

A ggplot2 theme object.

Examples

# \donttest{
library(ggplot2)
df <- data.frame(
  type = rep(c("A", "B"), each = 10),
  icon = rep(c("circle", "square"), each = 10)
)
ggplot(data = df, aes(icon = icon, color = type)) +
  geom_pop(size = 1) +
  theme_pop()

# }