This wraps ggsave and opens the folder where the graph was saved in a Shell.
From there, it can easily be dragged and dropped into the application where you want to use it.
It also changes the default units from in to cm, and defaults to saving temporary png files.
ggsave_show(filename = NULL, ..., device = NULL, units = "cm")https://stackoverflow.com/a/12135823/10581449
File name with path. If not provided, only a temporary file is saved
Arguments passed on to ggplot2::ggsave
plotPlot to save, defaults to last plot displayed.
pathPath of the directory to save plot to: path and filename
are combined to create the fully qualified file name. Defaults to the
working directory.
scaleMultiplicative scaling factor.
width,heightPlot size in units expressed by the units argument.
If not supplied, uses the size of the current graphics device.
dpiPlot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Only applies when converting pixel units, as is typical for raster output types.
limitsizeWhen TRUE (the default), ggsave() will not
save images larger than 50x50 inches, to prevent the common error of
specifying dimensions in pixels.
bgBackground colour. If NULL, uses the plot.background fill value
from the plot theme.
create.dirWhether to create new directories if a non-existing
directory is specified in the filename or path (TRUE) or return an
error (FALSE, default). If FALSE and run in an interactive session,
a prompt will appear asking to create a new directory when necessary.
Device to use. Can either be a device function
(e.g. png), or one of "eps", "ps", "tex" (pictex),
"pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only). If
NULL (default), the device is guessed based on the filename extension.
Unit for width and height, if provided. Defaults to "cm", can also be "in" or "mm"
if (FALSE) { # \dontrun{
ggplot(mtcars, aes(mpg)) + geom_histogram()
ggsave_show(here::here("mtcars.pdf"))
} # }