ggsave_ifs: Save a ggplot with IFS base dimensions

Description Usage Arguments Examples

View source: R/ggIFS.R

Description

This is a wrapper for ggsave which saves ggplots in default IFS dimensions for Word documents.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
ggsave_ifs(
  filename,
  plot = last_plot(),
  path = getwd(),
  widescreen = FALSE,
  save_data = FALSE,
  data_dir = path,
  data_name = filename,
  height = NA,
  width = NA,
  units = "mm",
  dpi = 320,
  device = "png",
  ...
)

Arguments

filename

Filename to create on disk (including .png)

plot

Plot to save

path

Path of the directory to save plot to: path and filename are combined to create the fully qualified file name. Defaults to current working directory.

widescreen

Default plot size is 100mm x 150mm. If TRUE, saves to 100mm x 60mm.

save_data

If TRUE, then it saves the data associated with the ggplot as a .csv file. This is not recommended for histograms / density plots.

data_dir

The directory to store the data if save_data == TRUE. The default is the directory entered in path.

data_name

The directory to

height

The height of the plot (default in mm)

width

The width of the plot (default in mm)

units

The units for height and width (can take one of "mm", "in", "cm", or "px")).

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, defaults to ".png". Can also be one of "eps", "ps", "tex" (pictex), "pdf", "jpeg", "tiff", "png", "bmp", "svg" or "wmf" (windows only).

...

Any other arguments for ggsave, such as changing heights and widths, dpi, format.

Examples

1
2
3
## Not run: g <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
ggsave_ifs("a_graph.png", g, "~/output")
## End(Not run)

vedanthnair/ggIFS documentation built on Jan. 14, 2022, 7:39 p.m.