This function previews a ggplot in its actual dimensions in order to see how
it will look when saved. It is also significantly faster than the default
preview in RStudio for ggplots created using cbbplotR. This is copied
directly from nflplotR.
Arguments
- plot
Plot to save, defaults to last plot displayed.
- width, height
Plot size in units expressed by the
unitsargument. If not supplied, uses the size of the current graphics device.- asp
The aspect ratio of the plot calculated as
width / height. If this is a numeric value (and notNULL) theheightof the plot will be recalculated toheight = width / asp.- dpi
Plot resolution. Also accepts a string input: "retina" (320), "print" (300), or "screen" (72). Applies only to raster output types.
- device
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 thefilenameextension.- units
One of the following units in which the
widthandheightarguments are expressed:"in","cm","mm"or"px".- scale
Multiplicative scaling factor.
- limitsize
When
TRUE(the default),ggsave()will not save images larger than 50x50 inches, to prevent the common error of specifying dimensions in pixels.- bg
Background colour. If
NULL, uses theplot.backgroundfill value from the plot theme.- ...
Other arguments passed on to the graphics device function, as specified by
device.