Learn R Programming

blockr.ggplot (version 0.1.0)

new_grid_block: Grid Block

Description

Combines multiple ggplot objects using patchwork::wrap_plots(). Variadic block that accepts 1 or more ggplot inputs with automatic alignment. Supports layout control (ncol, nrow) and annotations (title, subtitle, auto-tags).

Usage

new_grid_block(
  ncol = character(),
  nrow = character(),
  title = character(),
  subtitle = character(),
  caption = character(),
  tag_levels = character(),
  guides = "auto",
  ...
)

Value

A ggplot transform block object of class grid_block.

Arguments

ncol

Number of columns in grid layout (default: NULL for auto)

nrow

Number of rows in grid layout (default: NULL for auto)

title

Overall plot title (default: "")

subtitle

Overall plot subtitle (default: "")

caption

Overall plot caption (default: "")

tag_levels

Auto-tagging style: 'A', 'a', '1', 'I', 'i', or NULL (default: NULL)

guides

Legend handling: 'auto', 'collect', or 'keep' (default: 'auto')

...

Forwarded to new_ggplot_transform_block()

Examples

Run this code
# Create a grid block with 2 columns
new_grid_block(ncol = "2")

# Create a grid block with title
new_grid_block(title = "My Combined Plots", ncol = "2")

if (interactive()) {
  library(blockr.core)
  # Grid block requires multiple ggplot inputs
  serve(new_grid_block())
}

Run the code above in your browser using DataLab