Significance brackets, multiple-testing correction and effect-size tiles — rendered on the chart, drawn into every export.
CanvasXpress can annotate one-dimensional group charts — Boxplot, Violin and Bar — with pairwise significance brackets that print a p-value or stars, apply native multiple-testing correction, and hide comparisons that fail an FDR threshold. The design is renderer-first: the test statistics are computed upstream in R or Python (where the full test ecosystem lives), and the engine renders the result and derives corrected p-values and stars. This keeps the figure portable — the inference travels inside the spec and looks the same from JavaScript, R, Python, notebooks and dashboards.
Set showStatInference: true and supply a statInference object with a comparisons array. Each comparison names two groups (by category name or 1-based position), the raw p-value, and the height on the value axis at which to draw the bracket.
var cXInf = new CanvasXpress("canvasInference", groupData, {
graphType: "Boxplot",
showStatInference: true,
statInference: {
comparisons: [
{ groups: ["Control", "Low"], p: 0.032, value: 10.5 },
{ groups: ["Control", "High"], p: 0.0006, value: 12.0 }
],
correction: { method: "BH" },
annotate: "stars"
}
});
When you draw more than one bracket you are running multiple comparisons, so the p-values need correcting. Add a correction object and the engine computes the adjusted p-values natively — a byte-identical match to R’s p.adjust. Supported methods are BH (Benjamini–Hochberg, the default for FDR), bonferroni, BY, holm, hochberg and none. If you already have adjusted values, pass each comparison’s padj directly and no correction is applied.
| Key | Description |
|---|---|
showStatInference | Opt-in flag to render the inference layer (off by default, so other charts are unaffected) |
statInference.comparisons | Array of {groups: [a, b], p, padj?, value, label?, color?} items |
statInference.correction.method | BH | bonferroni | BY | holm | hochberg | none |
statInference.annotate | What each bracket prints: p, padj or stars |
statInference.fdrThreshold | Draw no bracket for a comparison whose corrected p is above this value |
Set fdrThreshold to suppress non-significant brackets: any comparison whose corrected p-value (or raw p-value when no correction applies) is above the threshold is not drawn. In dashboards this threshold is wired to an interactive FDR slider that re-filters every significance panel at once. The same inference machinery promotes the volcano threshold lines, so fold-change and significance cutoffs are first-class, exportable chart elements rather than manual decorations.
A p-value tells you whether, not how much. Effect-size tiles summarise the magnitude of a difference with its confidence interval alongside the chart, so a figure communicates both significance and effect in one place — the pairing reviewers expect in a publication.
Everything here is also reachable without code: the right-click menu and the Customizer expose the significance comparisons, the correction method and the annotation style, and the choices are saved with the configuration so the figure reproduces exactly.
showStatInference is set.