On this page
- Graph Families & Accepted Table Types (GraphKind)
- Series Styling, Error Bars & Overrides
- Axis Scales, Broken Axes & Frames
- — The Seven Axis Scales (AxisScale / GraphAxisScale)
- — Discontinuous / Broken Axes (AxisSegment)
- — Frame Presets, Thresholds & Additional Ticks
- Annotations, Pairwise Brackets, Piepho CLD & Live TeX Equations
- Colour Palettes, Colormaps & CVD Preview
- Batch Creation & Selective Style Inheritance (graph.create, graph.applyStyleFrom)
- Page Layout Composition (LayoutSpec)
- Publication Preflight & Export Capabilities & Limits
- — Canvas Print Preflight (graph.preflightCheck, QOL-8)
- — Supported Export Formats & Hard Safety Limits
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 Family | Accepted Sources | Built-In Visual Representations (GraphicalDataObject / Layout) |
|---|---|---|
Xy | Xy, MultipleVariables | Scatter 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. |
Column | Column, Nested | Column/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. |
Grouped | Grouped, Nested | Vertical 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. |
Contingency | Contingency | Grouped count bars, stacked count bars, and 100% normalized fraction stacked bars (PartsOfWholeLayout / categorical layout). |
PartsOfWhole | PartsOfWhole | Pie, Donut (annular cutout with optional center total), StackedFractionBar (100% horizontal bar), and Waffle10x10 (10×10 grid colored by rounded percentage). |
Survival | Survival, Survival ResultSheet | Kaplan–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. |
MultipleVariables | MultipleVariables | Bubble/scatter encoding via MultivariateGraphEncoding mapping categorical/continuous columns independently to X, Y, ColorChannelMapping, SizeChannelMapping, or marker symbol/split panels. |
Diagnostic(DiagnosticPlotKind) | ResultSheet / specialized inputs | Exploratory & 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, secondaryy2_axisassignment, marker shape (MarkerShapecircles/squares/triangles/diamonds/crosses), fill mode (MarkerFillModesolid/open/translucent), marker size in points, stroke dash style (LineDashStylesolid/dashed/dotted/dash-dot), summary measure (SummaryMeasure::{Mean, Median, GeometricMean}), connecting curve style (includingReplicateLineMode::IndividualReplicateTrajectoriesfor longitudinal trajectories), composite horizontal/point nudging (offset{ x_data, x_pt, y_pt }, withx_dataincluded in auto-axis bounds), optional bar width/border overrides (bar_width_override_pt,bar_border_width_pt), independentshow_raw_data& fitted-curve overlay visibility (so subset-filtered fits draw cleanly without duplicate markers), andall_series: truebatch updates across all datasets in a graph (graph.setSeries). - Error Bars (
ErrorBarSpec): ConfigurableErrorBarMetric: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 fromMeanSdN,MeanSemN,MeanCvN,MeanLowHigh,UpperLowerLimits, orMedianIqrsubcolumns) 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 incrementScaleDiagnostics::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; exactsubcolrules 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 Variant | Forward Mapping | Valid Domain |
|---|---|---|
Linear | x | All finite real numbers |
Log10 | log10(x) | Strictly positive x > 0 |
Log2 | log2(x) | Strictly positive x > 0 |
Ln | ln(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) |
Reciprocal | 1 / 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.0pt offset range-trimmed spines),PlainBoxed(4-sided box),DualYSecondaryRight(primary left Y paired with secondary righty2_axis), andOriginCrossing(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 onForestPlot).- 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 aResultSheet(edit.pasteResultTable) with configurableEmbeddedTableStyle(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-addressedProjectImageAssetitems inserted from PNG, JPEG, or TIFF payloads (graph.insertImage,layout.insertImage,edit.pasteImage,graph.updateImage,layout.updateImage) withCropInsetsPt,ImageBorderSpec,rotation_deg, andlock_aspect_ratio. SVG image payloads (<svg/<?xml) are rejected under clean-room/licence policy and zero remote URL fetches are performed; decoding enforcesMAX_IMAGE_ASSET_BYTES = 32 MiB,MAX_IMAGE_DIM_PX = 16,384px, andMAX_IMAGE_PIXELS = 67,108,864total pixels per asset and per compiled layout. - Live TeX Best-Fit Model Equations (
QOL-16/R10.19):GraphAnnotation::ModelEquation(graph.addAnnotationkindmodel_equation,ui.graph.insertModelEquation) links a graph directly to aLinearRegression,NonlinearRegression, orPassingBablokResultSheetdataset. SupportsEquationDisplayMode::SymbolicorEquationDisplayMode::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,\sqrtwith vinculum, stacked super/subscripts, scaled delimiters\left...\right, Greek parameters). - Pairwise Significance Brackets & Compact Letter Display (
PairwiseDisplayMode):BracketsOnly: Horizontal/stepped comparison brackets (PairwiseBracketSpec) withBracketStyleandBracketLabelMode(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, andMonochromePrint. - Continuous Colormaps (
ColormapId): Perceptually uniform Oklab-interpolated ramps (Viridis,Cividis,Plasma,DivergingBlueRed,Grayscale) plus custom user stops up toMAX_CUSTOM_STOPS = 256and discrete sampling up toMAX_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): Passingone_per_data_set: true(plus optional sharedy_axis_title) atomically creates one single-seriesGraphSheetper dataset from anyDataSheetor transformResultSheet(Transpose,Normalize,SelectAndTransform), checkingMAX_SHEETS_PER_PROJECTbefore 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 donorGraphSheetonto one target or multipletarget_sheet_idsin 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), supportingJournalWidthPreset(SingleColumn85Mm,SingleColumn89Mm,OneAndHalfColumn120Mm,OneAndHalfColumn136Mm,DoubleColumn174Mmdefault,DoubleColumn183Mm,LetterPortrait, etc.),FigureCanvasPreset(SingleColumn88mm,ColumnAndHalf130mm,DoubleColumn180mm,FullPagePortrait,Slide16x9,PosterPanel),PageOrientation(Portrait,Landscape), andCanvasResizeMode(KeepTypographyPtto preserve exactptsizes & line weights when resizing, vs.ProportionalScale). - Panel Arrangement, Equalization, Z-Order & Badges: Embedded
LiveGraphpanels,LiveTableblocks,EmbeddedImageitems, shared origin alignment (layout.alignOrigins), plot-scale equalization (layout.equalizeScalingwithEqualizeScaleMode::{MatchSmallest, MatchLargest, ExplicitPercent}normalizing innerplot_rect_ptscaling 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 automaticPanelBadgeStyle(UpperCaseLetters"A", "B", ...,LowerCaseLetters"a", "b", ..., orNone).
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
| Format | Engine Commands | Capabilities & Options | Enforced Limits |
|---|---|---|---|
SVG 1.1 (curvebook-svg) | export.svg, graph.exportSvg | Exact 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.exportPdf | Zlib-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.exportPng | 4x4 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.exportEmf | Clean-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 |