acl_figure_size()
View source ↗On this page
Recommend the width and height in inches at which a plot is saved, from its layout.
Usage
acl_figure_size(plot, width = NULL)
Arguments
| Argument | Default | Description |
|---|---|---|
plot | required | A ggplot or patchwork object, such as the result of a plot function of the package. |
width | NULL | Numeric or NULL. Width in inches. NULL chooses the width from the layout; a number is used as given, and the height is computed for it. |
Value
A named numeric vector c(width = , height = ) in inches. Sizes that the function chooses lie between 3 and 14 inches; a width given in the call is returned as given.
Details
The size comes from the rows and columns of panels, the title, subtitle and caption, slanted year labels and a legend below the panels. A single time series gets about 8 × 4.5 inches, faceted and multi-panel figures about 10 inches of width and 1.5 to 1.9 inches of height per row of panels, and plots of one quantity against another, such as plot_SSB_Rec(), a near-square shape. Sizes that the function chooses lie between 3 and 14 inches. A width given in the call is used as given, and the height is computed for it. acl_save_plot() saves a plot at this size.
Examples
Run the setup before the example. Fitting examples require an R-compatible C++ toolchain; simulation and export examples may write files.
Example setup
library(ALSCL)
library(ggplot2)
library(patchwork)
data("YTF_example")
x <- YTF_example
inputs <- x[c("data.CatL", "data.wgt", "data.mat")]
dat <- x$data.CatL
a <- run_acl(x, silent = TRUE)
b <- run_alscl(x, silent = TRUE)
# Use objects defined above
p <- plot_SSB(a, se = TRUE)
acl_figure_size(p)
acl_figure_size(p, width = 6)