Skip to contents

R6 class defining properties for saving a ggplot object

Public fields

name

character defining the name of the file to be saved (without extension)

path

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

format

character defining the format of the file to be saved

width

numeric values defining the width in units of the plot dimensions after saving

height

numeric values defining the height in units of the plot dimensions after saving

units

character defining the unit of the saving dimension

dpi

(dots per inch) numeric value defining plot resolution

Methods


Method new()

Create a new ExportConfiguration object

Usage

ExportConfiguration$new(
  path = NULL,
  name = NULL,
  format = NULL,
  width = NULL,
  height = NULL,
  units = NULL,
  dpi = NULL
)

Arguments

path

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

name

character defining the name of the file to be saved (without extension)

format

character defining the format of the file to be saved.

width

numeric values defining the width in units of the plot dimensions after saving

height

numeric values defining the height in units of the plot dimensions after saving

units

character defining the unit of the saving dimension

dpi

numeric value defining plot resolution (dots per inch)

Returns

A new ExportConfiguration object


Method print()

Print properties of export configuration

Usage

ExportConfiguration$print()

Returns

Export configuration properties


Method getFileName()

Print the default exported file name from the export configuration

Usage

ExportConfiguration$getFileName()

Returns

Default file name


Method savePlot()

Save/Export a plot

Usage

ExportConfiguration$savePlot(plotObject, fileName = NULL)

Arguments

plotObject

A ggplot object

fileName

character file name of the exported plot

Returns

The file name of the exported plot


Method convertPixels()

If unit is in pixels, convert all export dimensions to inches to keep compatibility with older versions of ggplot2

Usage

ExportConfiguration$convertPixels()


Method clone()

The objects of this class are cloneable with this method.

Usage

ExportConfiguration$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.