Half-Violin, Raincloud, and Split-Violin Plots Arrive in CanvasXpress

Violin plots are great at showing the shape of a distribution, but a full symmetric violin has always had one drawback: half of the ink is redundant. Both sides mirror the same density curve, which leaves no room to show anything else — like the raw data points, a boxplot summary, or a second group sharing the same axis slot.

CanvasXpress now supports half violins, which unlocks three increasingly popular layouts that data scientists have been recreating by hand in other tools:

All of this is driven by a small set of configuration options, and because the default behavior is untouched, every existing violin chart renders exactly as it did before.

Turning on a half violin

The new violinSide option controls which half of the violin is drawn: 'lt' (left when vertical, top when horizontal), 'rb' (right/bottom), or the default 'both' for the traditional symmetric shape.

var cx = new CanvasXpress("chart1", data, {
  graphType: "Boxplot",
  showViolinBoxplot: true,
  violinSide: "lt",
  showBoxplotOriginalData: true
});

With showBoxplotOriginalData turned on, CanvasXpress automatically places the raw data points on the opposite half from the violin — giving you the density shape on one side and the actual observations on the other, with nothing overlapping. If you want the points somewhere specific, violinPointsSide lets you pin them explicitly to 'lt', 'rb', or even 'center'.

Full raincloud: violin + box + points

Add a boxplot into the mix with showBoxplotIfViolin, and CanvasXpress will divide the band into ordered sub-slots so the violin, box, and points sit cleanly next to each other instead of overlapping:

var cx = new CanvasXpress("chart2", data, {
  graphType: "Boxplot",
  showViolinBoxplot: true,
  showBoxplotIfViolin: true,
  showBoxplotOriginalData: true,
  violinSide: "lt",
  violinPartitionOrder: ["violin", "boxplot", "points"]
});

violinPartitionOrder accepts any permutation of the elements you've chosen to display, so you can reorder them — points first, then the box, then the violin — without touching anything else in your configuration.

Per-group sides for paired comparisons

Both violinSide and violinPointsSide can take an object instead of a single value, keyed by sample group or variable name. This is what makes a true paired raincloud plot possible: each group can face a different direction.

var cx = new CanvasXpress("chart3", data, {
  graphType: "Boxplot",
  showViolinBoxplot: true,
  showBoxplotIfViolin: true,
  showBoxplotOriginalData: true,
  violinSide: { Baseline: "lt", Followup: "rb" },
  violinPartitionOrder: ["violin", "boxplot", "points"],
  connectBy: "subjectID"
});

Here, the "Baseline" group's violin opens to the left and "Followup" opens to the right, so the two clouds face each other with their boxplots and points tucked in between. Pairing this with connectBy draws a line between each subject's baseline and follow-up measurement — the data points the lines connect to are the same jittered points drawn on the chart, so the connectors always land exactly where the dots are.

For multi-panel layouts, the same configuration works alongside segregateSamplesBy, so you can lay out several paired-raincloud panels side by side and still color the connecting lines by a grouping factor using connectByPointColor.

Split violins for direct group comparison

The second major layout is the split violin: instead of two groups sitting in adjacent bands, they share a single band and meet at a common centerline — one group's density curve mirrored against the other's. Set violinSide to 'split' and point CanvasXpress at a two-level grouping factor with colorBy or segregateSamplesBy:

var cx = new CanvasXpress("chart4", data, {
  graphType: "Boxplot",
  showViolinBoxplot: true,
  violinSide: "split",
  colorBy: "Smoker",
  showBoxplotIfViolin: true,
  boxplotWidthRatioIfViolin: 0.15
});

Each level of the Smoker factor is automatically assigned to one half of the band, flattened against the shared centerline — so you get a single, fused violin whose left and right profiles are directly comparable at every point along the axis. When a boxplot is layered on top of a split violin, CanvasXpress draws one combined box straddling the center line, summarizing both halves together rather than duplicating the box per side, and you can narrow it with boxplotWidthRatioIfViolin to keep it visually light.

If you also want the raw points overlaid on a split violin, setting violinPointsSide: "center" pools the points from both levels into a single jittered cloud over the shared centerline — the "inner points" look familiar from seaborn's split violins.

Nothing to migrate

Every one of these behaviors is opt-in through the violinSide, violinPointsSide, and violinPartitionOrder options. Leave them unset, or leave violinSide at its default 'both', and your existing boxplot/violin charts render exactly as before — no config changes, no visual differences.

Try it

If you're already using CanvasXpress's Boxplot/Violin graph type, half violins are a drop-in upgrade: add violinSide, decide whether you want a boxplot and raw points, and you have a raincloud plot. Add a two-level grouping factor and switch to violinSide: "split" for a direct side-by-side density comparison. As always, you can save any chart you build via the Save as JSON action in the toolbar, and reload it later by dragging the saved file back onto the chart — making it easy to share a finished raincloud or split-violin layout with a collaborator exactly as you configured it.