Recommended figure dimensions for mfsusie_plot()
Source: R/mfsusie_plot.R
mfsusie_plot_dimensions.RdReturns a width and height (in inches) sized to the number of
panels mfsusie_plot() will draw on the supplied fit. The
recommendation accounts for the PIP cell, the per-outcome
effect cells, and the per-CS sub-cells when facet_cs = "stack" is used with K >= 2 credible sets. Useful for
setting fig.width / fig.height in a knitr chunk so each
panel has enough vertical space to render legibly.
Usage
mfsusie_plot_dimensions(
fit,
m = NULL,
facet_cs = c("auto", "stack", "overlay"),
smooth_method = NULL,
min_pip_height = 3,
min_cell_height = 3,
width = 8
)Arguments
- fit
- m
optional integer index. When supplied, recommend dimensions for the focused single-outcome view.
- facet_cs
"auto","stack", or"overlay". Default"auto"matchesmfsusie_plot()'s default.- smooth_method
optional smoother name to resolve
facet_cs = "auto"against the smoothed credible bands.- min_pip_height
minimum height (in) for the PIP cell.
- min_cell_height
minimum height (in) for each effect cell.
- width
figure width in inches. Default
8.
Value
a list with components width, height (numeric,
inches) and n_cells (integer, total panel count).
Details
Sizing principle: each cell rendered by mfsusie_plot() is a
base-graphics panel with a fixed margin overhead (top title +
bottom axis labels = ~1.0 inch) plus the actual data plotting
area. min_cell_height is the total allotted height per
cell — set it to the desired plotting area (~1.6 in) plus the
~1.0 in margin overhead. The defaults (3.0 in per cell) leave
~2.0 in of plot area, which is the visual sweet spot for the
effect curve + lfsr-overlay panels emitted by TI / HMM
smoothings. PIP and effect cells use the SAME total height so
that the underlying layout() weights (uniform) match the
returned height. The recommended figure width defaults to
width = 8 inches.
Examples
# \donttest{
set.seed(1L)
n <- 100; p <- 20
X <- matrix(rnorm(n * p), n)
Y <- list(matrix(rnorm(n * 32), n), matrix(rnorm(n * 32), n))
fit <- mfsusie(X, Y, L = 4, verbose = FALSE)
fit_s <- mf_post_smooth(fit)
mfsusie_plot_dimensions(fit_s, facet_cs = "stack")
#> $width
#> [1] 8
#>
#> $height
#> [1] 6
#>
#> $n_cells
#> [1] 3
#>
# }