Skip to contents
0.16.6 documentation

Complete canonical API text; task articles explain the workflows. Tutorials

Site guide · find your task

Builds on a temporary device of the requested kind and measures the actual single panel after gtable layout, then refines physical geometry within a bounded render-local context. The original plot and its layout cache are left unchanged. Standard saving continues to use ggplot2::ggsave().

Usage

Code
diagnose_ggchord(
  plot,
  width = 7,
  height = 5,
  units = c("in", "cm", "mm", "px"),
  device = c("png", "pdf", "svg"),
  dpi = 144,
  min_size = 2,
  min_linewidth = 0.2,
  colour_vision = FALSE
)

Arguments

plot

A ggchord plot.

width, height

Positive target canvas dimensions.

units

Dimensions in "in", "cm", "mm", or "px".

device

Target device: "png", "pdf", or "svg". It must be available in the current R environment. Only this device is inspected.

dpi

Raster resolution; also defines pixel dimensions.

min_size, min_linewidth

Advisory minimum text size and line width, both in millimetres. These do not modify the supplied style.

colour_vision

Request optional simulated colour-vision hints.

Value

A ggchord_diagnostics list with measurement, checks, text and guide measurements, colour suggestions, existing label_diagnostics, annotation_registry, track_registry, track_diagnostics, and captured device warnings. Field units and provenance are described in ggchord_layout_contract. measurement$status concerns panel measurement only; it never means that all quality or portability checks passed.

Details

Results describe evidence, not a general quality certificate. Checks cover registered vertex bounds, measured text, small text/lines, oversized guides, and existing label/track diagnostics. Objects outside a panel with clip = "off" are legal when they still fit the canvas. Unregistered custom grobs, arrowhead extents, font embedding/fallback and cross-application transparency are not certified. Device warnings remain in the report.

Grayscale suggestions compare luminance of opaque discrete mapped colours (difference below 0.05); continuous gradients are deliberately excluded. With colour_vision = TRUE, optional colorspace public simulations for protan/deutan/tritan at severity 1 in linear RGB flag Lab distances below 10. These heuristic thresholds ignore spatial context, alpha compositing and viewing conditions, and never automatically change the plot or fail a run.

Examples

Code
library(dplyr)
data(seq_data_example)
seqs <- seq_data_example |>
  select(accver, length)
p <- ggchord(seq_data = seqs) +
  geom_seq()
diagnose_ggchord(p, width = 8, height = 6, units = "in", device = "png")