canvas: Add a canvas specification to a ggplot object
Description
A canvas specification essentially comprises a set of parameters
from ggplot2::ggsave(). When a plot with this canvas specification is
printed, it is rendered as it would appear if saved to a file with the
specified dimensions.
An object of class canvas that can be added to a ggplot object
to specify the plot dimensions.
Arguments
width, height
Plot size in units expressed by the units argument.
If not supplied, uses the size of the current graphics device.
units
One of the following units in which the width and height
arguments are expressed: "in", "cm", "mm" or "px".
dpi
Plot 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.
scale
Multiplicative scaling factor.
bg
Background colour. If NULL, uses the plot.background fill value
from the plot theme.