diff --git a/src/style.js b/src/style.js index d77bd0f1b8..c239fa56ab 100644 --- a/src/style.js +++ b/src/style.js @@ -252,7 +252,7 @@ function groupAesthetics( export function groupZ(I, Z, z) { const G = group(I, (i) => Z[i]); - if (z === undefined && G.size > I.length >> 1) { + if (z === undefined && G.size > (1 + I.length) >> 1) { warn( `Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null.` ); diff --git a/test/output/pairsArea.svg b/test/output/pairsArea.svg new file mode 100644 index 0000000000..33fb1b772a --- /dev/null +++ b/test/output/pairsArea.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plots/index.ts b/test/plots/index.ts index b6886b388d..64f185bdd9 100644 --- a/test/plots/index.ts +++ b/test/plots/index.ts @@ -168,6 +168,7 @@ export * from "./music-revenue.js"; export * from "./npm-versions.js"; export * from "./opacity.js"; export * from "./ordinal-bar.js"; +export * from "./pairs.js"; export * from "./penguin-annotated.js"; export * from "./penguin-culmen-array.js"; export * from "./penguin-culmen-delaunay-mesh.js"; diff --git a/test/plots/pairs.ts b/test/plots/pairs.ts new file mode 100644 index 0000000000..ffa6ba9ebe --- /dev/null +++ b/test/plots/pairs.ts @@ -0,0 +1,6 @@ +import * as Plot from "@observablehq/plot"; +import * as d3 from "d3"; + +export async function pairsArea() { + return Plot.areaY({length: 15}, {y: d3.randomLcg(42), stroke: (d, i) => i >> 1}).plot({axis: null, height: 140}); +}