facet_unwrap(g, plot = TRUE, save = FALSE, path = ".", ...)

Arguments

g

the ggplot2 object created as normal

plot

whether to plot (or just save by turn the next args to TRUE)

save

whether to save the plot to disk

path

where to save them?

...

Arguments passed on to ggplot2::ggsave

filename

File name to create on disk.

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 the filename extension.

scale

Multiplicative scaling factor.

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). Applies only to raster output types.

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 the plot.background fill value from the plot theme.

create.dir

Whether 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.

Value

invisible a list of ggplot objects, one for each panels

Examples

if (FALSE) {
g <- iris %>%
  ggplot(aes(Sepal.Length)) +
  geom_histogram() +
  facet_wrap(~Species)
facet_unwrap(g)
}