ggexport: Export ggplots

Description Usage Arguments Author(s) Examples

View source: R/ggexport.R

Description

Export ggplots

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ggexport(
  ...,
  plotlist = NULL,
  filename = NULL,
  ncol = NULL,
  nrow = NULL,
  width = 480,
  height = 480,
  pointsize = 12,
  res = NA,
  verbose = TRUE
)

Arguments

...

list of plots to be arranged into the grid. The plots can be either ggplot2 plot objects, arbitrary gtables or an object of class ggarrange.

plotlist

(optional) list of plots to display.

filename

File name to create on disk.

ncol

(optional) number of columns in the plot grid.

nrow

(optional) number of rows in the plot grid.

width, height

plot width and height, respectively (example, width = 800, height = 800). Applied only to raster plots: "png", "jpeg", "jpg", "bmp" and "tiff".

pointsize

the default pointsize of plotted text (example, pointsize = 8). Used only for raster plots.

res

the resolution in ppi (example, res = 250). Used only for raster plots.

verbose

logical. If TRUE, show message.

Author(s)

Alboukadel Kassambara <alboukadel.kassambara@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
require("magrittr")
# Load data
data("ToothGrowth")
df <- ToothGrowth
df$dose <- as.factor(df$dose)

# Box plot
bxp <- ggboxplot(df, x = "dose", y = "len",
    color = "dose", palette = "jco")
# Dot plot
dp <- ggdotplot(df, x = "dose", y = "len",
    color = "dose", palette = "jco")
# Density plot
dens <- ggdensity(df, x = "len", fill = "dose", palette = "jco")

# Export to pdf
ggarrange(bxp, dp, dens, ncol = 2) %>%
  ggexport(filename = "test.pdf")

# Export to png
ggarrange(bxp, dp, dens, ncol = 2) %>%
  ggexport(filename = "test.png")
 
## End(Not run)

ggpubr documentation built on July 2, 2020, 2:12 a.m.