save_last_plot {novelqualcodes}R Documentation

Save the most recent plot to a file

Description

Save the most recent plot to a file

Usage

save_last_plot(
  filename = stop("A save path and filename must be specified."),
  size = "4 x 3 in",
  dpi = 300,
  ...
)

Arguments

filename

(Character) The path and filename of the file to create.

size

(Character) The output size of the file, in the form ⁠"width x height unit⁠. For example: - "5 x 7 in" - "12 x 8 cm" - "300 x 150 mm" - "1920 x 1080 px"

dpi

(Integer) The resolution (dots per inch) of the output file.

...

Other arguments passed to ggplot2::ggsave().

Value

This function returns nothing, but has the side-effect of writing a file to filename.

See Also

plot_novelty(), plot_richness()

Examples


# Coding matrices included with the package
path_to_matrices <- system.file("insect_study/matrices/", package = "novelqualcodes")

# Import the data
my_matrices    <- import_coding_matrices(path_to_matrices)

# Score novel and duplicate codes
my_scores <- score_codes(my_matrices)

# Generate a plot with no refinements
plot_richness(score_df = my_scores)

# Save it to a temporary directory
save_last_plot(file.path(tempdir(), "test_plot.png"), size = "4 x 3 in")

# Open the temporary directory (if session is running interactively)
if (interactive()) { utils::browseURL(tempdir()) }



[Package novelqualcodes version 0.13.1 Index]