Opens the graphics device that matches the extension of file (.png,
.tiff, .jpg, .pdf, .svg or .eps), evaluates the plotting code
and closes the device. Raster formats carry the resolution in their
header, as journals ask.
Usage
save_figure(
file,
expr,
width = 16,
height = 11,
units = c("cm", "mm", "in"),
res = 600,
pointsize = 10
)Examples
fit <- design_anova(maize_nitrogen, "Yield_t_ha", "Nitrogen_kg_ha", block = "Block")
f <- tempfile(fileext = ".png")
save_figure(f, plot(compare_means(fit, "Nitrogen_kg_ha")), width = 12, height = 9)
file.exists(f)
#> [1] TRUE