diff --git a/src/marks/auto.d.ts b/src/marks/auto.d.ts
index 760cfc6d21..c6d5aa4ea5 100644
--- a/src/marks/auto.d.ts
+++ b/src/marks/auto.d.ts
@@ -92,7 +92,7 @@ export interface AutoOptions {
* should usually suffice, and setting an explicit mark type may lead to a
* nonsensical plot (especially if you change other options).
*/
- mark?: "area" | "bar" | "dot" | "line" | "rule";
+ mark?: "area" | "bar" | "dot" | "line" | "rule" | "box" | "voronoi";
}
/**
diff --git a/src/marks/auto.js b/src/marks/auto.js
index 4724a98f68..63a7ecc4d2 100644
--- a/src/marks/auto.js
+++ b/src/marks/auto.js
@@ -11,6 +11,7 @@ import {frame} from "./frame.js";
import {line, lineX, lineY} from "./line.js";
import {rect, rectX, rectY} from "./rect.js";
import {ruleX, ruleY} from "./rule.js";
+import {boxX, boxY} from "./box.js";
export function autoSpec(data, options) {
options = normalizeOptions(options);
@@ -141,6 +142,10 @@ export function autoSpec(data, options) {
: cell;
colorMode = "fill";
break;
+ case "box":
+ markImpl = X && isOrdinal(X) ? boxY : boxX;
+ colorMode = "fill";
+ break;
default:
throw new Error(`invalid mark: ${mark}`);
}
@@ -359,6 +364,8 @@ const impls = {
rectX,
rectY,
cell,
+ boxX,
+ boxY,
bin,
binX,
binY,
diff --git a/test/output/autoBox.svg b/test/output/autoBox.svg
new file mode 100644
index 0000000000..e3f3cd0cc7
--- /dev/null
+++ b/test/output/autoBox.svg
@@ -0,0 +1,286 @@
+
\ No newline at end of file
diff --git a/test/output/autoVoronoi.svg b/test/output/autoVoronoi.svg
new file mode 100644
index 0000000000..2e7455107c
--- /dev/null
+++ b/test/output/autoVoronoi.svg
@@ -0,0 +1,416 @@
+
\ No newline at end of file
diff --git a/test/plots/autoplot.ts b/test/plots/autoplot.ts
index 619a8639c6..5711ce35e9 100644
--- a/test/plots/autoplot.ts
+++ b/test/plots/autoplot.ts
@@ -1,6 +1,11 @@
import * as Plot from "@observablehq/plot";
import * as d3 from "d3";
+export async function autoBox() {
+ const athletes = await d3.csv("data/athletes.csv", d3.autoType);
+ return Plot.auto(athletes, {x: "weight", y: "sex", mark: "box", color: "sex"}).plot();
+}
+
// Tanner's bug https://github.com/observablehq/plot/issues/1365
export async function autoLineZero() {
const industries = await d3.csv("data/bls-industry-unemployment.csv", d3.autoType);