merge_pdf: Merge Different Sized Plots

Description Usage Arguments Value Note Examples

Description

Allows for merging of different sized R plots.

Usage

1
merge_pdf(n.plots, file, widths = 8, heights = 8, n.lines = 1)

Arguments

n.plots

The number of plots to be combined.

file

A connection, or a character string naming the file to print to.

widths

A vector of widths equal to n.plots or a single value that will be used for all plot widths.

heights

A vector of heights equal to n.plots or a single value that will be used for all plot widths.

n.lines

A vector of integer values indicating the number of lines each plotting sequence will take. Default is 1 line each.

Value

Returns a single combined plot of various sizes.

Note

To use with ggplot the plotting sequence must be wrapped with plot().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
merge_pdf(3, file = "foo.pdf", widths = c(7, 7, 10), heights = c(6, 10, 7))
plot(1:10)
plot(1:10, pch=19)
plot(1:10, col="red", pch=19)

library(ggplot2)
p <- ggplot(mtcars, aes(factor(cyl), mpg)) + geom_boxplot()
merge_pdf(2, file = "bar.pdf", widths = c(7, 10), heights = c(6, 10))
plot(1:10)
print(p)

## End(Not run)

trinker/plotflow documentation built on May 31, 2019, 9:42 p.m.