Violin Plots Join the Heatmap Overlay Family in CanvasXpress

Heatmaps are great at showing a matrix of values at a glance, but the real analytical payoff often comes from the annotation tracks ringing the plot — the thin strips along the rows and columns that summarize a sample's phenotype, a gene's expression distribution, or a cluster's composition. CanvasXpress has long supported a rich set of these "overlay" track types: categorical color bars, pie wedges, stacked bars, and boxplots. Today, that lineup grows by one important member: violin plots.

Why this matters

A boxplot overlay tells you the median and quartiles of a distribution packed into a column or row. That's useful, but it collapses shape information — bimodality, skew, long tails — into five numbers. A violin plot keeps that shape visible by rendering a kernel density estimate as a mirrored silhouette, so a reviewer scanning a heatmap's side tracks can immediately spot which samples have a tight, unimodal distribution and which ones are bimodal or heavily skewed, without leaving the figure.

This is exactly the kind of annotation you see in published multi-panel genomics figures: a clustered heatmap surrounded by a categorical bar, a donut/pie summary, a bar chart, and a violin track — all stacked together on the same edge. Previously, every piece of that stack except the violin was available directly as a CanvasXpress overlay type. Now the full stack is native.

Using it

Heatmap overlay tracks are configured the same way you've always configured them — through smpOverlays / varOverlays (which tracks to show, and in what order) and smpOverlayProperties / varOverlayProperties (how each track looks and behaves). Each track declares a type. Where you previously had "Boxplot", you can now set:

var cx = new CanvasXpress("chartContainer", data, {
  graphType: "Heatmap",
  smpOverlays: ["F1"],
  smpOverlayProperties: {
    F1: {
      type: "Violin",
      position: "top",
      thickness: 80,
      color: "rgb(100,120,200)"
    }
  }
});

That's the whole switch — change type from "Boxplot" to "Violin" and the track renders as a per-column (or per-row, depending on position) density silhouette instead of a box-and-whisker summary. Everything else about the track — its position, thickness, color, legend and name display, and label rotation — behaves exactly as it does for every other overlay type, so existing layouts don't need to be rethought; you're simply swapping in a richer visual for the distribution you were already summarizing.

Violin-specific styling knobs are honored too: violinScale to control whether width reflects density, area, or raw count; violinTrim to clip the tails at the data range; violinTransparency and violinColor for appearance; and showViolinQuantiles if you want quantile lines drawn inside the shape. If a track also sets a boxplot-style inner summary, that overlay is drawn centered inside the violin, giving you both the shape and the quartile markers in one band — handy when reviewers want the density view and the classic five-number summary side by side.

Mixing track types on one heatmap

The real strength of this feature shows up when you combine multiple overlay types around the same heatmap — which is the common case in published figures. A single heatmap can carry, for example, a categorical color bar and a pie-chart track and a bar-chart track across its columns, while its rows carry a pie track and a violin track. Each track is just another entry in smpOverlays/varOverlays with its own type, and CanvasXpress lays them out as independent bands around the matrix, each sized by its own thickness. Because violin is a first-class overlay type now, it slots into that stack exactly like any other track — no special-casing required, and no risk of disturbing the layout of the tracks already in place next to it.

Discovering and tweaking it visually

If you'd rather not hand-edit JSON, the Customizer panel's overlay configuration now lists Violin alongside Boxplot in the track-type picker, so you can add or convert an overlay track interactively and immediately see the result. Once you're happy with a layout, use the Save as JSON action in the chart's File menu to capture the whole configuration — data, overlay tracks, and all — into a single file. Drop that saved .json file back onto a CanvasXpress container later (or hand it to a colleague to drop onto theirs) and the exact same annotated heatmap reloads, violin tracks included. For a fully auditable trail of how a complex multi-overlay heatmap was constructed, the chart's Reproduce toolbar action will step back through its construction so you can confirm, panel by panel, how the tracks were built.

Try it

If you're building figures that mix categorical, proportional, and distributional annotation tracks around a clustered heatmap — the kind of layered summary panel common in expression and single-cell analyses — the violin overlay closes the last gap in that toolkit. Swap type: "Boxplot" for type: "Violin" on any existing overlay track and you'll get a density silhouette in its place, with the same positioning and styling options you already know. Existing boxplot overlays, and every other overlay type, are untouched — this is a pure addition to the track vocabulary, not a change to how the tracks you already have behave.

Check the CanvasXpress gallery's Heatmap examples for a full worked reproduction of a multi-track figure combining categorical, pie, bar, and violin overlays on both axes, and use it as a starting template for your own annotated heatmaps.