Use a PHA-branded ggplot2 theme
Usage
theme_pha(
base_size = 10,
base_family = "Noto Sans",
flip_gridlines = FALSE,
output_format = NULL,
html_adjust = 0,
pdf_adjust = 0,
...
)Arguments
- base_size
The base size of text elements; defaults to 10
- base_family
The base font family; defaults to "Noto Sans"
- flip_gridlines
Orientation of major gridlines; defaults to FALSE for y-axis
- output_format
Optional manual specification of output format
- html_adjust
Amount subtracted from base_size for HTML output; defaults to 0
- pdf_adjust
Amount subtracted from base_size for PDF output; defaults to 0
- ...
Additional arguments passed to ggplot2::theme()
Value
A ggplot2::theme() object.
Details
When overriding strip text under ggplot2 >= 4.0, use
ggtext::element_markdown(), never a raw ggplot2::element_text(): the
branded strip element is a ggtext markdown element, and ggplot2 4.0 only
merges theme elements of the same class.
The theme alone carries PHA's brand identity into an otherwise
unbranded plot: bar/column fills, point colors, and line colors default
to pha_colors["Green"] (via ggplot2::element_geom()), a discrete
aes(colour =)/aes(fill =) mapping cycles through the full PHA
palette, and a continuous mapping uses the PHA sequential ramp
(see scale_color_pha_c()) — all with no scale_*() call required.
An explicit scale_*() (or a manual aes() value) always overrides
these theme-carried defaults.
