Take Control of Your UpSet Plots: Sorting, Filtering, and Highlighting in CanvasXpress
▶ UpSet Full Complex-Upset Reproduction (Movies Dataset)
When you need to compare more than three or four sets, a Venn diagram collapses into an unreadable tangle. The UpSet plot is the modern answer: a matrix of dots showing which sets each intersection combines, a bar for the size of every intersection, and a bar for the size of every set. CanvasXpress has rendered UpSet plots for a while. What's new is that you now have real control over which intersections appear, in what order, and which ones stand out.
These additions bring CanvasXpress's UpSet plot in line with what power users expect from the richest tools in this space: sorting, filtering, and query-based highlighting — all as straightforward configuration, all defaulting to off so your existing UpSet charts are unchanged.
Sorting: put the interesting bars where the eye lands
By default an UpSet plot orders sets and intersections by size, descending. That's a sensible start, but not always what you want. Three new controls let you decide:
upsetSortSets— order the set rowsdescending,ascending, or leave them in your input order withnone.upsetSortIntersections— same three choices for the intersection columns.upsetSortIntersectionsBy— choose the metric that drives the order:cardinality(how many elements are in the intersection),degree(how many sets it combines), orratio.
new CanvasXpress("canvas", {
graphType: "Upset",
upsetSortIntersectionsBy: "degree",
upsetSortIntersections: "ascending",
data: { /* set membership */ }
});
Sorting by degree, for instance, groups the single-set columns, then the two-set overlaps, then the three-set ones — a natural way to walk from "unique to one set" toward "shared across many."
Filtering: show only the intersections that matter
A real-world UpSet plot can have dozens of possible intersections, most of them tiny or empty. Five controls let you trim the display down to the signal:
upsetMinSize/upsetMaxSize— keep only intersections whose element count falls in a range.upsetMinDegree/upsetMaxDegree— keep only intersections that combine a given number of sets.nUpSetIntersections— after sorting and the filters above, keep just the top N columns.
new CanvasXpress("canvas", {
graphType: "Upset",
upsetMinDegree: 2,
nUpSetIntersections: 6,
data: { /* set membership */ }
});
That example drops every "unique to a single set" column and shows the six largest shared intersections — exactly the view you want when the story is about overlap, not about what each set holds alone. Every one of these parameters defaults to "no filtering," so turning none of them on reproduces today's full plot precisely.
Query highlighting: make a finding pop
The last addition is the most expressive. The upsetQueries parameter lets you recolor a specific set or a specific intersection so a key result jumps out of an otherwise uniform plot. Each query names a target and a color:
new CanvasXpress("canvas", {
graphType: "Upset",
upsetQueries: [
{ intersect: ["Drama", "Comedy"], color: "rgb(220,20,60)" }
],
data: { /* set membership */ }
});
A query with a set name highlights that set's row and its set-size bar. A query with an intersect list highlights the matching intersection — its size bar and its dots in the matrix — in the color you choose. It's the difference between "here is all the data" and "here is the overlap I want you to look at."
Annotation panels: distributions above the matrix
Beyond the core controls, CanvasXpress UpSet plots can now carry annotation panels — compact strips of distribution plots, such as box or violin summaries, stacked above the intersection matrix. Each panel lines up column-for-column with the intersections below it, so you can show not just how big each intersection is but how a measurement is distributed within it. Highlighting can be scoped independently to the matrix, the size bar, or a named panel, so you can draw attention to exactly one part of the figure.
These panels scale correctly with the chart: on a responsively shrinking canvas the matrix, set bars, and panels all keep their proportions instead of sliding off the bottom. CanvasXpress's own UpSet example reproduces a full real-world dataset of tens of thousands of rows at both full and reduced sizes.
Everything defaults to off
The design principle throughout: none of these controls changes a chart you've already built. Leave them unset and your UpSet plot renders precisely as it did before. Add them one at a time to reorder, trim, and highlight until the figure says what you need it to say.
Try it today
If you work with set overlaps — genes across conditions, tags across documents, features across cohorts — CanvasXpress's UpSet plot now gives you the sorting, filtering, and highlighting controls to turn a raw intersection dump into a focused figure. Set graphType: "Upset", add the controls that fit your question, and, as with every CanvasXpress chart, save the result to a PNG that carries its own configuration so the exact view is reproducible.