Documented release: v0.1.0-alpha.2 · 2026-11-24 (commit b1c6ebb158) No scripts · No telemetry · A–Z Index
On this page

Graphs, Page Layouts & Export Capabilities

CurveBook compiles every graph specification (GraphSheet) and multi-panel composition (LayoutSheet) into a device-independent vector intermediate representation (ChartScene, crates/chart), guaranteeing identical geometry across desktop canvas rendering, SVG, %PDF-1.7, PNG/TIFF rasterization, and ECMA-234 Enhanced Metafiles (.emf).

See Command Reference, Automation: MCP, Analysis Kinds Registry, and Parametric Equations Registry for graph/layout and overlay parameters.


Graph Families & Accepted Table Types (GraphKind)

CurveBook exposes eight GraphKind families (crates/doc/src/graph.rs), each bound to compatible DataSheet or ResultSheet inputs:

GraphKind FamilyAccepted SourcesBuilt-In Visual Representations (GraphicalDataObject / Layout)
XyXy, MultipleVariablesScatter symbols, connecting lines (PointToPoint, Staircase, Fritsch–Carlson / Steffen MonotonicCubicSpline, AkimaSpline), longitudinal replicate trajectories (IndividualReplicateTrajectories spaghetti plots), error envelopes, fitted curve & confidence/prediction band overlays (FittedCurveOverlay), AUC shading, before-after connections.
ColumnColumn, NestedColumn/vertical or horizontal (CartesianOrientation::Horizontal) bars with error bars, superimposed replicate dots (DeterministicBeeswarm or AlignedColumn), mean/median summary lines, before-after paired trajectories, box-and-whisker (Tukey1_5Iqr, MinToMax, Percentile10To90, Percentile5To95, Percentile2_5To97_5, Percentile1To99), kernel violin plots, and truncated/truncated+raw combinations.
GroupedGrouped, NestedVertical or horizontal (CartesianOrientation::Horizontal, including back-to-back stacked Population Pyramids) bars/boxes/violins/points arranged via GroupedArrangement (Interleaved, Separated, Stacked, Superimposed) for two-way and three-way designs.
ContingencyContingencyGrouped count bars, stacked count bars, and 100% normalized fraction stacked bars (PartsOfWholeLayout / categorical layout).
PartsOfWholePartsOfWholePie, Donut (annular cutout with optional center total), StackedFractionBar (100% horizontal bar), and Waffle10x10 (10×10 grid colored by rounded percentage).
SurvivalSurvival, Survival ResultSheetKaplan–Meier curves rendered in SurvivalDisplayMetric (PercentSurvival, PercentCumulativeEvent, or FractionSurvival) as staircase steps or point-to-point polylines, censored-subject tick marks, selectable Greenwood error display (ConfidenceInterval95 bands or Sem), median survival crosshairs, and aligned Number at Risk tables.
MultipleVariablesMultipleVariablesBubble/scatter encoding via MultivariateGraphEncoding mapping categorical/continuous columns independently to X, Y, ColorChannelMapping, SizeChannelMapping, or marker symbol/split panels.
Diagnostic(DiagnosticPlotKind)ResultSheet / specialized inputsExploratory & regression diagnostic plots: Heatmap (continuous ramp + configurable HeatmapLabelSpec row/column labels & 0°/45°/90° angles, optionally auto-created from transform.run with create_graph: true), Volcano (-log10P / adjusted q vs. effect fold change), BlandAltman (bias & limits of agreement), RocCurve (sensitivity vs. 1 - specificity + diagonal reference), ForestPlot (regression estimates or pre-summarized Grouped/Column study bounds UpperLowerLimits/MeanLowHigh with optional pooled diamond and reference lines), ResidualPlot (residuals vs. fitted/order), and NormalQqPlot (sample vs. Blom normal quantiles).

Series Styling, Error Bars & Overrides

  • Series Controls (SeriesSpec): Per-dataset visibility, label, colour with RGBA opacity/alpha, secondary y2_axis assignment, marker shape (MarkerShape circles/squares/triangles/diamonds/crosses), fill mode (MarkerFillMode solid/open/translucent), marker size in points, stroke dash style (LineDashStyle solid/dashed/dotted/dash-dot), summary measure (SummaryMeasure::{Mean, Median, GeometricMean}), connecting curve style (including ReplicateLineMode::IndividualReplicateTrajectories for longitudinal trajectories), composite horizontal/point nudging (offset { x_data, x_pt, y_pt }, with x_data included in auto-axis bounds), optional bar width/border overrides (bar_width_override_pt, bar_border_width_pt), independent show_raw_data & fitted-curve overlay visibility (so subset-filtered fits draw cleanly without duplicate markers), and all_series: true batch updates across all datasets in a graph (graph.setSeries).
  • Error Bars (ErrorBarSpec): Configurable ErrorBarMetric:
    • Sd (± 1 SD, n - 1 denominator)
    • Sem (± 1 SEM= SD/√n)
    • ConfidenceInterval95 (two-sided 95% Student-t interval around the sample mean)
    • InterquartileRange (asymmetric [Q1, Q3] quartiles)
    • Range ([min, max])
    • ExplicitSubcolumns (pre-summarized bounds read directly from MeanSdN, MeanSemN, MeanCvN, MeanLowHigh, UpperLowerLimits, or MedianIqr subcolumns) with directional options (ErrorBarDirection::{Both, UpperOnly, LowerOnly}) and selectable end caps/stroke patterns. On log scales, non-positive lower error bounds clamp safely to the axis floor and increment ScaleDiagnostics::log_error_bars_clamped.
  • Per-Point Overrides (PointStyleOverride): Targets (series_index, point_index, optional subcol) (graph.formatSelectedPoints) to highlight, restyle, or hide single replicates without mutating upstream cell data; exact subcol rules take precedence over wildcard overrides.

Axis Scales, Broken Axes & Frames

The Seven Axis Scales (AxisScale / GraphAxisScale)

Configured per axis (x_axis, y_axis, secondary y2_axis in crates/doc/src/graph.rs, crates/chart/src/scales.rs):

Scale VariantForward MappingValid Domain
LinearxAll finite real numbers
Log10log10(x)Strictly positive x > 0
Log2log2(x)Strictly positive x > 0
Lnln(x)Strictly positive x > 0
Logit(LogitDomain)ln(p1 - p) (unit [0, 1] or [0, 100]% domain)Strictly open interior 0 < p < 1 (or 0 < p < 100)
ProbitΦ-1(u / 100)Strictly open percentage interior u ∈ (0, 100)
Reciprocal1 / x (with direction reversal option)Non-zero x ≠ 0

Observations outside a non-linear axis domain (or non-finite points) are safely omitted and counted in ScaleDiagnostics (non_positive_log_skipped, out_of_domain_logit_skipped, out_of_domain_probit_skipped, zero_reciprocal_skipped, non_finite_skipped) rather than collapsing or panicking. Each segment generates at most MAX_TICKS_PER_SEGMENT = 256 ticks using TickLabelFormat (Decimal, AbsoluteDecimal for unsigned back-to-back pyramid magnitudes, PowerOfTenSuperscript, ScientificE, Antilog, EngineeringSi, Categorical), paired with per-axis TickDirection (Outside, Inside, Both, None) and show_tick_labels visibility toggles.

Discontinuous / Broken Axes (AxisSegment)

Every axis (AxisSpec::segments) supports 1 to 3 contiguous AxisSegment ranges (MAX_SEGMENTS_PER_AXIS = 3), each specifying its [min, max] interval and proportional visual share, separated by gap_width_pt with a selectable BreakOrnament (DoubleSlash, Zigzag, BlankGap). Series bars, lines, and points clip cleanly at break boundaries.

Frame Presets, Thresholds & Additional Ticks

  • FramePreset: OpenL (default left-and-bottom L frame), OffsetRangeTufte (DEFAULT_AXIS_OFFSET_PT = 6.0 pt offset range-trimmed spines), PlainBoxed (4-sided box), DualYSecondaryRight (primary left Y paired with secondary right y2_axis), and OriginCrossing (axes intersecting at (0, 0)).
  • AxisThreshold & AdditionalTick: Horizontal/vertical dashed or shaded threshold bands (graph.setAxes), custom labelled tick marks (graph.setAdditionalTicks), and vertical reference gridlines (for example null-effect lines on ForestPlot).
  • Canvas & Paper Backgrounds (paper_fill, background_fill): Solid fills or transparent (None) plot/page fills (graph.setStyle / Format Graph › Page), enabling axis-free transparent foreground overlays and insets in multi-panel layouts.

Annotations, Pairwise Brackets, Piepho CLD & Live TeX Equations

  • Geometric & Text Annotations (GraphAnnotation): Lines, arrows, rectangles, ellipses, shaded spans, free-form rich text callouts (subscripts/superscripts, Greek Unicode, Info constant hooks {{Info:Key}} and Result scalar hooks expanded automatically), and legend placement (LegendSpec).
  • Live Embedded Result Tables (GraphAnnotation::EmbeddedResultTable & LayoutItem::LiveTable): Reactive rectangular cell slices (selected_rows, selected_cols) pasted directly from a ResultSheet (edit.pasteResultTable) with configurable EmbeddedTableStyle (transpose, show_column_titles, show_row_titles, bold_headers, font_size_pt, outer_border_width_pt, gridline_width_pt, border_color, fill_color), re-evaluating via the DAG across RGBA, SVG, %PDF-1.7, and .emf.
  • Embedded Raster Images (GraphAnnotation::EmbeddedImage & LayoutItem::EmbeddedImage): Content-addressed ProjectImageAsset items inserted from PNG, JPEG, or TIFF payloads (graph.insertImage, layout.insertImage, edit.pasteImage, graph.updateImage, layout.updateImage) with CropInsetsPt, ImageBorderSpec, rotation_deg, and lock_aspect_ratio. SVG image payloads (<svg/<?xml) are rejected under clean-room/licence policy and zero remote URL fetches are performed; decoding enforces MAX_IMAGE_ASSET_BYTES = 32 MiB, MAX_IMAGE_DIM_PX = 16,384 px, and MAX_IMAGE_PIXELS = 67,108,864 total pixels per asset and per compiled layout.
  • Live TeX Best-Fit Model Equations (QOL-16 / R10.19): GraphAnnotation::ModelEquation (graph.addAnnotation kind model_equation, ui.graph.insertModelEquation) links a graph directly to a LinearRegression, NonlinearRegression, or PassingBablok ResultSheet dataset. Supports EquationDisplayMode::Symbolic or EquationDisplayMode::Substituted (refreshing coefficients automatically on fit recalculation) and renders using two-dimensional Knuth TeXbook Appendix G math box typesetting (crates/chart/src/equation_box.rs: stacked \frac/\dfrac/\tfrac/\binom, \sqrt with vinculum, stacked super/subscripts, scaled delimiters \left...\right, Greek parameters).
  • Pairwise Significance Brackets & Compact Letter Display (PairwiseDisplayMode):
    • BracketsOnly: Horizontal/stepped comparison brackets (PairwiseBracketSpec) with BracketStyle and BracketLabelMode (stars *..****/ns, formatted P-value, or custom text).
    • CompactLetterDisplayOnly (graph.setCompactLetterDisplay): Computes exact minimal equivalence letter sets ("a", "ab", "b", ...) directly from pairwise comparison significance records using Piepho's (2004) insert-and-absorb plus sweeping algorithm (CldOrdering::{DescendingMean, AscendingMean}), placing conflict-free letter annotations above bars/boxes/violins.
    • BracketsAndCompactLetterDisplay: Renders both non-overlapping brackets and compact letters simultaneously.

Colour Palettes, Colormaps & CVD Preview

  • Qualitative Scientific Palettes (PaletteId, crates/palette): OkabeIto (default CVD-safe 8-colour palette), PaulTolBright, PaulTolMuted, PaulTolHighContrast, PaulTolVibrant, and MonochromePrint.
  • Continuous Colormaps (ColormapId): Perceptually uniform Oklab-interpolated ramps (Viridis, Cividis, Plasma, DivergingBlueRed, Grayscale) plus custom user stops up to MAX_CUSTOM_STOPS = 256 and discrete sampling up to MAX_DISCRETE_SAMPLES = 4,096.
  • Live CVD & Grayscale Canvas Preview (QOL-9): Applies Machado (2009) physiologically validated colour-vision-deficiency transformation matrices (CanvasPreviewFilter::{Normal, Deuteranopia, Protanopia, Tritanopia, GrayscalePrint}, serialized "grayscale" for grayscale print) in the viewport rasterizer (crates/render) without altering stored graph specs or exported vector files.

Batch Creation & Selective Style Inheritance (graph.create, graph.applyStyleFrom)

  • Batch One-Graph-Per-Data-Set (graph.create): Passing one_per_data_set: true (plus optional shared y_axis_title) atomically creates one single-series GraphSheet per dataset from any DataSheet or transform ResultSheet (Transpose, Normalize, SelectAndTransform), checking MAX_SHEETS_PER_PROJECT before mutating the document.
  • Multi-Target Style Cloning (graph.applyStyleFrom): apply_style_from_selective (crates/doc/src/graph.rs) copies selected styling facets (axis scales/ticks/frame, palette/series styling, fonts, error bar defaults, legend placement, or canvas preset dimensions) from a donor GraphSheet onto one target or multiple target_sheet_ids in a single atomic undo step while preserving each target's upstream data bindings, series titles, and fitted overlays.

Page Layout Composition (LayoutSpec)

LayoutSheet composes publication multi-panel figures (MAX_LAYOUT_ITEMS = 64 per page):

  • Physical Units & Presets: Coordinates and margins in PhysicalUnit (Points, Millimeters, Inches), supporting JournalWidthPreset (SingleColumn85Mm, SingleColumn89Mm, OneAndHalfColumn120Mm, OneAndHalfColumn136Mm, DoubleColumn174Mm default, DoubleColumn183Mm, LetterPortrait, etc.), FigureCanvasPreset (SingleColumn88mm, ColumnAndHalf130mm, DoubleColumn180mm, FullPagePortrait, Slide16x9, PosterPanel), PageOrientation (Portrait, Landscape), and CanvasResizeMode (KeepTypographyPt to preserve exact pt sizes & line weights when resizing, vs. ProportionalScale).
  • Panel Arrangement, Equalization, Z-Order & Badges: Embedded LiveGraph panels, LiveTable blocks, EmbeddedImage items, shared origin alignment (layout.alignOrigins), plot-scale equalization (layout.equalizeScaling with EqualizeScaleMode::{MatchSmallest, MatchLargest, ExplicitPercent} normalizing inner plot_rect_pt scaling ratios within <= 0.25 pt), Z-order stacking (layout.reorderPanel: bring_to_front, bring_forward, send_backward, send_to_back), transparent foreground overlays/insets (paper_fill: None, hidden axis ticks/labels), decorative shapes/text headers, and automatic PanelBadgeStyle (UpperCaseLetters "A", "B", ..., LowerCaseLetters "a", "b", ..., or None).

Publication Preflight & Export Capabilities & Limits

Canvas Print Preflight (graph.preflightCheck, QOL-8)

preflight_check_scene inspects compiled ChartScene primitives prior to export and emits non-blocking warnings when:

  • Any visible text element or subscript/superscript span renders below 5.0 pt (min_font_size)
  • Any stroked path renders below 0.25 pt (hairline_stroke)
  • Text anchor or bounding box clips outside the canvas or clip rectangle (text_outside_canvas)

Supported Export Formats & Hard Safety Limits

FormatEngine CommandsCapabilities & OptionsEnforced Limits
SVG 1.1 (curvebook-svg)export.svg, graph.exportSvgExact cubic/quadratic paths, CSS/attribute styling, pretty, include_xml_declaration, include_metadata, embed_fonts (when runtime TTF faces present), outline_text glyph paths, coordinate precision (0..=6, default 3). Validated structurally via validate_svg_structure.Finite bounds, precision capped at 6
%PDF-1.7 Vector (curvebook-pdf)export.pdf, graph.exportPdfZlib-compressed vector streams (compress_streams), selectable Core-14 WinAnsi + Adobe Symbol text or optional embedded TrueType / outline_text vector glyphs, alpha ExtGState transparency, sRGB / CMYK / Grayscale colour spaces (PdfColorSpace), multi-page compilation, physical trim_pt / bleed_pt boxes, BiDi RTL reordering.MAX_PDF_PAGES = 64 pages, MAX_PDF_TOTAL_PRIMITIVES = 500,000 primitives, MAX_PDF_OUTPUT_BYTES = 32 MiB
PNG & TIFF Raster (curvebook-render)export.png, export.tiff, graph.exportPng4x4 subpixel coverage antialiasing (BEZIER_FLATNESS_TOL_PX = 0.15), DPI-based or explicit pixel sizing, physical pHYs / TIFF resolution metadata (dpi), TIFF compression (None, Lzw, Deflate). Aspect ratio is strictly preserved on DPI scaling; oversize uniform targets return an explicit limit error rather than stretching dimensions.MAX_RASTER_DIM_PX = 16,384 px per side, MAX_RASTER_PIXELS = 67,108,864 total pixels (8192 × 8192 equivalent)
Windows Enhanced Metafile .emf (curvebook-render)graph.exportEmf, layout.exportEmfClean-room little-endian ECMA-234 vector records (MM_ANISOTROPIC, 0.01 mm rclFrame, 20 twips/pt logical precision, EMR_POLYBEZIERTO, Unicode EMR_EXTTEXTOUTW, optional BGRA DIB fallback raster).Finite positive dimensions fitting 32-bit EMF nBytes
Ready · Offline Desktop · CLI · Local MCP Pure Rust Zero Telemetry MIT / Apache-2.0