| Title: | Publication-Quality 'ggplot2' Geom Width |
|---|---|
| Description: | Width helper functions for publication-quality 'ggplot2' visualisation. These functions make it easier to create geoms such as bars that have a consistent width appearance across plots. |
| Authors: | David Hodge [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-3868-7501>) |
| Maintainer: | David Hodge <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.2 |
| Built: | 2026-07-07 04:49:31 UTC |
| Source: | https://github.com/davidhodge931/ggwidth |
ggplot2 geom widthStandardise the width in ggplot2 geoms so that widths appear visually
consistent across plots with different numbers of categories, panel dimensions,
and orientations.
This can be used in geoms such as ggplot2::geom_bar(),
ggplot2::geom_col(), ggplot2::geom_boxplot(),
and ggplot2::geom_errorbar().
The relevant panel dimension must be an absolute physical unit (for example
grid::unit(..., "mm")), either supplied directly or set in the current theme.
Relative units are not supported.
get_width( ..., n = NULL, n_dodge = NULL, orientation = c("x", "y"), equiwidth = NULL, panel_widths = NULL, panel_heights = NULL )get_width( ..., n = NULL, n_dodge = NULL, orientation = c("x", "y"), equiwidth = NULL, panel_widths = NULL, panel_heights = NULL )
... |
Must be empty. Forces all other arguments to be named and allows trailing commas. |
n |
Number of categories in the orientation aesthetic (that is, |
n_dodge |
Number of dodge categories. Intended for use with
|
orientation |
Orientation: |
equiwidth |
Numeric scaling factor controlling apparent width. A value of
|
panel_widths |
A |
panel_heights |
A |
A single numeric width suitable for the width argument of geoms such
as ggplot2::geom_bar() or ggplot2::geom_col().
Set a global default for the equiwidth argument used by get_width().
set_equiwidth(equiwidth = 1)set_equiwidth(equiwidth = 1)
equiwidth |
A single positive finite numeric value. |
The previous option value, invisibly.