View source: R/plot_fitverse.R
| save_plot | R Documentation |
Renders the two-panel diagnostic plot for a fitverse object and
saves it as a high-resolution PNG (or PDF) file, without displaying the
figure on the current graphics device. Suitable for embedding in reports
or automated pipelines.
save_plot(fit,
file = file.path(tempdir(), "fitverse_plot.png"),
which = "both",
top_n = 3L,
xlab = NULL,
width = 14,
height = 5.5,
dpi = 600,
...)
fit |
An object of class |
file |
Character: output file path. The file extension determines the format:
|
which |
Which panels to save: |
top_n |
Number of top-ranked distributions to show on the density panel.
Default |
xlab |
Character: x-axis label. Defaults to |
width |
Numeric: plot width in inches. Default |
height |
Numeric: plot height in inches. Default |
dpi |
Integer: resolution in dots per inch. Default |
... |
Additional arguments passed to |
Uses grDevices::png() (or grDevices::pdf() / grDevices::svg()
depending on file extension) and gridExtra::grid.arrange() to render
both panels in a single device call, ensuring consistent alignment.
The function opens the graphics device, renders the figure, and closes the
device via on.exit(), so the current interactive device is unaffected.
Invisibly returns the normalised path to the saved file (character).
Karuna G. Reddy karuna.reddy@auckland.ac.nz
M. G. M. Khan mgm.khan@usp.ac.fj
plot.fitverse for interactive display.
set.seed(42)
x <- rgamma(300, shape = 2, rate = 0.5)
fit <- fitverse(x, plot = FALSE, verbose = FALSE)
save_plot(fit, file = tempfile(fileext = ".png"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.