Skip to contents
Chapters and reference

Complete canonical API text; task articles explain the workflows. Usage guide

Add this policy to a ggchord plot. The ordinary print, ggsave, preview and diagnostic paths rebuild at the actual device or Fusion panel size. Plots without a policy retain their existing behaviour.

Usage

R · Example code
adapt_ggchord(
  mode = c("adaptive", "fixed", "scale"),
  reference_size = c(8, 6),
  text_scale_range = c(0.85, 1.35),
  min_text_size = 2.5
)

Arguments

mode

One of adaptive, fixed, or scale.

reference_size

Positive width and height in inches. Scale modes use the fourth root of target/reference area, with a bounded text multiplier.

text_scale_range

Lower and upper positive text multipliers containing 1. Lines and default spacing use the square root of the text multiplier.

min_text_size

Lower bound in mm for automatically reduced theme text. Defaults already smaller than this value are preserved rather than enlarged. Explicit text sizes and existing label-fit policies keep their own contracts.

Value

A plot policy added with +. Target-size diagnose_ggchord() results include adaptive_layout (effective styles and scale factors) and guide_layout (candidates, constraints, chosen layouts and measured bounds). A feasible guide layout is not certification of every label or arbitrary grob. Ordinary layout-only exports report the policy without claiming a target-device guide arrangement.

Details

fixed keeps default theme sizes and guide furniture at their reference physical sizes. scale adjusts theme-driven default text, lines and spacing within bounds. adaptive additionally selects a joint arrangement of trained native legends and colour bars, then remeasures the complete plot. Existing label layout is rerun with the resulting sizes; this is not a new global label collision solver. Data, source coordinates and scale mappings are unchanged. Omitted fixed line widths in native backbone, link, ribbon and alignment layers follow the bounded line factor. Explicit widths and mapped widths retain their own values and scale rules. Other geometry constants and native theme-derived aesthetic expressions are not uniformly multiplied.

Explicit geom styles, mapped sizes, theme fields and guide constraints take priority. Only unspecified guide grids, directions and positions can change. Continuous/stepped bars stay intact and retain their scale breaks and order. Unknown custom guides are measured but not rearranged. Infeasible layouts warn and report their constraints; categories are never silently removed.

Apply a policy to each desired Fusion panel before composition. Cross-panel endpoints are rebuilt after panel measurement; the outer Fusion allocations and its separate relationship guide are not controlled by this policy. Facets and arbitrary annotation grobs are outside the automatic layout contract.

Examples

R · Example code
library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
seqs <- seq_data_example |>
  slice_head(n = 2) |>
  select(accver, length)
p <- ggchord(seqs) +
  geom_seq() +
  geom_seq_label() +
  adapt_ggchord(reference_size = c(8, 6))
p

# ggplot2::ggsave("adaptive.png", p, width = 8, height = 6, units = "in")

Search documentation

↑ ↓ select · Enter open · Esc close; or browse by task. API and functions