| Title: | Publication-Quality 'ggplot2' Geom Width |
| Version: | 0.1.2 |
| 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. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/davidhodge931/ggwidth, https://davidhodge931.github.io/ggwidth/ |
| BugReports: | https://github.com/davidhodge931/ggwidth/issues |
| Depends: | R (≥ 4.1.0) |
| Imports: | ggplot2 (≥ 4.0.0), grid, rlang |
| Suggests: | dplyr, forcats, patchwork, testthat (≥ 3.0.0), tibble, withr |
| Encoding: | UTF-8 |
| Language: | en-GB |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-07-07 00:11:47 UTC; david |
| Author: | David Hodge |
| Maintainer: | David Hodge <davidhodge931@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-07 02:10:02 UTC |
ggwidth: 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.
Author(s)
Maintainer: David Hodge davidhodge931@gmail.com (ORCID) [copyright holder]
Authors:
David Hodge davidhodge931@gmail.com (ORCID) [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/davidhodge931/ggwidth/issues
Standardise ggplot2 geom width
Description
Standardise 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.
Usage
get_width(
...,
n = NULL,
n_dodge = NULL,
orientation = c("x", "y"),
equiwidth = NULL,
panel_widths = NULL,
panel_heights = NULL
)
Arguments
... |
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 |
Value
A single numeric width suitable for the width argument of geoms such
as ggplot2::geom_bar() or ggplot2::geom_col().
Set a global equiwidth
Description
Set a global default for the equiwidth argument used by get_width().
Usage
set_equiwidth(equiwidth = 1)
Arguments
equiwidth |
A single positive finite numeric value. |
Value
The previous option value, invisibly.