gpsave: gpsave

View source: R/gpsave.R

gpsaveR Documentation

gpsave

Description

Wrapper for ggplot2::ggsave() with galacticPubs defaults

Usage

gpsave(
  filename,
  obj = ggplot2::last_plot(),
  WD = "?",
  save_dir = "assets/_R_outputs",
  width = NULL,
  height = NULL,
  aspect = 16/9,
  dpi = 300,
  open = FALSE,
  bg = "transparent",
  units = "in",
  ...
)

Arguments

filename

expects filename, with file extension (e.g. "plot.png"); can also include subfolder (e.g. "newfolder/plot.png")

obj

ggplot or grid object; default= ggplot2::last_plot()

WD

working directory; default="?" or a unit picker dialog

save_dir

which subfolder of WD do you want to save file to? default="assets/_R_outputs"

width

plot width in inches (default= 7)

height

plot height in inches default= NULL will calculate from aspect

aspect

ratio of width to height; default= 16/9; aspect is ignored if width and height are supplied

dpi

dots per inch resolution (default= 300); note changing this will unfortunately also change the output relative text size

open

logical; open file after save? default=FALSE

bg

background color (default= "transparent")

units

default= "in"; options c("in", "cm", "mm", "px")

...

other parameters from ggplot2::ggsave()

Details

Most important thing it does is default to saving in the assets/_R_outputs/ folder in the unit working directory and save with reasonable dimensions that maintain large, readable text size of graph labels


galacticpolymath/GPpub documentation built on April 5, 2025, 6:04 p.m.