diff --git a/src/marks/axis.js b/src/marks/axis.js
index 7c7944a55f..3a0e644909 100644
--- a/src/marks/axis.js
+++ b/src/marks/axis.js
@@ -672,10 +672,10 @@ export function inferTickFormat(scale, data, ticks, tickFormat, anchor) {
? inferTimeFormat(scale.type, data, anchor) ?? formatDefault
: scale.tickFormat
? scale.tickFormat(typeof ticks === "number" ? ticks : null, tickFormat)
+ : typeof tickFormat === "string" && scale.domain().length > 0
+ ? (isTemporal(scale.domain()) ? utcFormat : format)(tickFormat)
: tickFormat === undefined
? formatDefault
- : typeof tickFormat === "string"
- ? (isTemporal(scale.domain()) ? utcFormat : format)(tickFormat)
: constant(tickFormat);
}
diff --git a/test/output/tickFormatEmptyDomain.svg b/test/output/tickFormatEmptyDomain.svg
new file mode 100644
index 0000000000..38e50ca56f
--- /dev/null
+++ b/test/output/tickFormatEmptyDomain.svg
@@ -0,0 +1,17 @@
+
\ No newline at end of file
diff --git a/test/output/tickFormatEmptyFacetDomain.svg b/test/output/tickFormatEmptyFacetDomain.svg
new file mode 100644
index 0000000000..38e50ca56f
--- /dev/null
+++ b/test/output/tickFormatEmptyFacetDomain.svg
@@ -0,0 +1,17 @@
+
\ No newline at end of file
diff --git a/test/plots/index.ts b/test/plots/index.ts
index 3176991d75..f54398dca7 100644
--- a/test/plots/index.ts
+++ b/test/plots/index.ts
@@ -309,6 +309,7 @@ export * from "./style-overrides.js";
export * from "./symbol-set.js";
export * from "./text-overflow.js";
export * from "./this-is-just-to-say.js";
+export * from "./tick-format.js";
export * from "./time-axis.js";
export * from "./tip-format.js";
export * from "./tip.js";
diff --git a/test/plots/tick-format.ts b/test/plots/tick-format.ts
new file mode 100644
index 0000000000..66b2898f9e
--- /dev/null
+++ b/test/plots/tick-format.ts
@@ -0,0 +1,9 @@
+import * as Plot from "@observablehq/plot";
+
+export async function tickFormatEmptyDomain() {
+ return Plot.plot({y: {tickFormat: "%W"}, marks: [Plot.barX([]), Plot.frame()]});
+}
+
+export async function tickFormatEmptyFacetDomain() {
+ return Plot.plot({fy: {tickFormat: "%W"}, marks: [Plot.barX([]), Plot.frame()]});
+}