highqualgraphR: Publication-grade export of ggplot2 object

Description Usage Arguments Examples

View source: R/highqualgraphR.R

Description

This function takes a ggplot2 object and a series of extensions as input to export it to. A high quality graph is generated complying to PLOS ONE author guidelines.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
highqualgraphR(
  x,
  filename,
  res = 1200,
  pointsize = 12,
  embed = FALSE,
  extension = "pdf",
  graphicstype = "cairo",
  colorspace = "cmyk",
  subdirectory = "/figure"
)

Arguments

x

a ggplot2 object.

filename

the filename without an extension.

res

resolution (ppi) of the graph, defaults to 1200

pointsize

font size (pixels), defaults to 12

embed

a logical indicating wether in the font should be embedded in a pdf or eps document. This is done to enhance compatibility with older viewers or when using a non-standard font (see ?embedFonts for details). It requires ghostscript to be installed.

extension

character vector including: "pdf", "png", "tiff", "svg" or "postscript"

graphicstype

passed on to the "type" parameter in bitmap graphics devices (defaults to "cairo", but requires cairo graphics)

colorspace

sets the colorspace. For printing such as in papers the default colorspace should be CMYK but for on-screen viewing srgb may be more desirable. Can also be set to gray to enable greyscale printing. Defaults to CMYK.

subdirectory

a sub-directory to the current working directory where to save the file. If it does not exist, it is created. Defaults to "figure/"

Examples

1
2
3
4
## Short example

# Load precomputed example data
#TODO: find test object

CMET-UGent/CMETNGS documentation built on Dec. 12, 2020, 8:22 a.m.