drawExport {draw}R Documentation

Export Current Drawing Page to a File

Description

Export Current Drawing Page to a File

Usage

drawExport(f, width = .pkgenv$pageWidth, height = .pkgenv$pageHeight,
  ppi = .pkgenv$exportPPI, format = tools::file_ext(f),
  textSize = .pkgenv$textSize, units = .pkgenv$exportUnits, ...)

Arguments

f

Character value of the file path to save to. Must include file name and extension.

width

Numeric value of the image width.

height

Numeric value of the image height.

ppi

Numeric value of the image resolution quality in Pixels Per Inch (PPI).

format

Character value of the extension for file without a period ".".

textSize

Size of text (pt) in image.

units

Character value for the unit to use when specifying measurements. Can be one of the following:

  • "px", "pixels", "pixel", "pix"

  • "in", "inches", "inch"

  • "cm", "centimeters", "centimeter", "centimetre", "centimetres"

  • "mm", "millimeters", "millimeter", "millimetre", "millimetres"

...

Additional arguments passed to dev.copy.

Value

The name and number of the device, according to dev.copy, which has been copied to.

See Also

drawSettings

Examples

library(draw)

# Set drawing settings
drawSettings(pageWidth = 5, pageHeight = 5, units = "inches")

# Create a new drawing page
drawPage()

# Draw a square
drawBox(x = 1, y = 4, width = 2, height = 2)

# Export the drawing page to a PDF
drawExport("export.pdf")

# Export the drawing page to a PNG
drawExport("export.png", ppi=300)


[Package draw version 1.0.0 Index]