plots | R Documentation |
A wrapper around patchwork to plot multiple figures side by side on the same page.
plots(
...,
n_rows = NULL,
n_columns = NULL,
guides = NULL,
tags = FALSE,
tag_prefix = NULL,
tag_suffix = NULL,
tag_sep = NULL,
title = NULL,
subtitle = NULL,
caption = NULL,
theme = NULL
)
... |
Multiple |
n_rows |
Number of rows to align plots. |
n_columns |
Number of columns to align plots. |
guides |
A string specifying how guides should be treated in the
layout. |
tags |
Add tags to your subfigures. Can be |
tag_prefix , tag_suffix |
Text strings that should appear before or after the tag. |
tag_sep |
Text string giving the separator to use between different tag levels. |
title , subtitle , caption |
Text strings to use for the various plot annotations to add to the composed patchwork. |
theme |
A ggplot theme specification to use for the plot. Only elements related to titles, caption, and tags, as well as plot margin and background, are used. |
See the patchwork documentation for more advanced control of plot layouts.
library(ggplot2)
library(see)
p1 <- ggplot(mtcars, aes(x = disp, y = mpg)) +
geom_point()
p2 <- ggplot(mtcars, aes(x = mpg)) +
geom_density()
p3 <- ggplot(mtcars, aes(x = factor(cyl))) +
geom_bar() +
scale_x_discrete("cyl")
plots(p1, p2)
plots(p1, p2, n_columns = 2, tags = "A")
plots(
p1, p2, p3,
n_columns = 1, tags = c("Fig. 1", "Fig. 2", "Fig. 3"),
title = "The surprising truth about mtcars"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.