A white-background ggplot2 theme based on the Urban Institute style,
with gray horizontal grid lines and a clean, minimal aesthetic. Designed
to pair with viridis, inferno, grayscale, or solaris color palettes
(set via set_theme).
Usage
theme_t2m(
base_size = 18,
base_family = "sans",
base_line_size = NULL,
base_rect_size = NULL,
panel_spacing = NULL,
network = NULL,
medium = c("screen", "print")
)Arguments
- base_size
Numeric. Base font size in points (default
18).- base_family
Character. Base font family (default
"sans").- base_line_size
Deprecated. No longer used; ggplot2 4.0+ computes line sizes from
base_size. A warning is issued if supplied.- base_rect_size
Deprecated. No longer used; ggplot2 4.0+ computes rect sizes from
base_size. A warning is issued if supplied.- panel_spacing
Deprecated. No longer used as a theme parameter. Use
theme(panel.spacing = unit(..., "pt"))directly. A warning is issued if supplied.- network
Logical or
NULL(default). IfNULL, ggraph plots are auto-detected at plot-add time and network mode is applied automatically. PassTRUEto force network mode (no axes/grid) orFALSEto force standard mode regardless of plot type.- medium
Character. Output medium:
"screen"(default) for presentations and PDF viewing, or"print"for physical printing with heavier lines and darker text.
Value
When network = NULL (default), an object of class
"theme_t2m_autodetect" that resolves at + time.
When network is explicitly TRUE or FALSE, a
plain ggplot2 theme object.
Details
When added to a plot with +, theme_t2m() auto-detects
whether the plot is a ggraph network visualization and removes
axes and grid lines accordingly. Pass network = TRUE or
network = FALSE to override auto-detection.
Examples
if (FALSE) { # \dontrun{
library(ggplot2)
# Basic usage -- auto-detects plot type
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
theme_t2m()
# Print-optimized with heavier lines
ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
geom_point(size = 3) +
theme_t2m(medium = "print")
} # }
