ggsave_elsevier {lehuynh}R Documentation

Save a plot - Elsevier figure size

Description

Save a plot using ggplot2::ggsave(). Plot size follows instructions of Elsevier journals.

Usage

ggsave_elsevier(
  filename,
  plot,
  width = c("one_column", "one_half_column", "full_page"),
  height,
  ...
)

Arguments

filename

A character string. File name to create on disk.

plot

Plot to save, ggplot or other grid object.

width

Plot width. See Details for more information.

height

Plot height in "mm".

...

Passed to ggplot2::ggsave()

Details

Instruction of Elsevier about sizing of artwork.

Value

An image file containing the saved plot.

See Also

ggplot2::ggsave()

Examples


library(ggplot2)

fig <- ggplot(mtcars, aes(y = mpg, x = disp)) +
    geom_point(aes(colour = factor(cyl)))

## For demo, a temp. file path is created with the file extension .png
png_file <- tempfile(fileext = ".png")

ggsave_elsevier(png_file, plot = fig, width = "full_page", height = 120)

[Package lehuynh version 0.1.1 Index]