| compose | R Documentation |
Compose multiple glyph specs into a layout
compose(
...,
type = "hstack",
widths = NULL,
heights = NULL,
gap = 10,
shared_scales = FALSE,
linked_selections = FALSE,
title = NULL
)
... |
glyph_spec objects or layout objects (for nesting) |
type |
Layout type: "hstack", "vstack", "grid", "wrap" |
widths |
Relative widths for columns (e.g. c(2, 1) for 2:1 split) |
heights |
Relative heights for rows |
gap |
Gap between plots in px |
shared_scales |
Share axis scales across plots: TRUE, FALSE, "x", "y", or "both" |
linked_selections |
Share interaction selections across plots |
title |
Overall layout title |
A glyph_layout object
p1 <- glyph(mtcars, x = wt, y = mpg) |> mark_point()
p2 <- glyph(mtcars, x = wt, y = hp) |> mark_point()
p3 <- glyph(mtcars, x = hp, y = mpg) |> mark_line()
# Horizontal stack
compose(p1, p2, type = "hstack")
# Grid with linked brushing
compose(p1, p2, p3, type = "wrap",
linked_selections = TRUE, shared_scales = "x")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.