diff --git a/examples/compiled/bar_q_qpow.png b/examples/compiled/bar_q_qpow.png
new file mode 100644
index 0000000000..4218f3713a
Binary files /dev/null and b/examples/compiled/bar_q_qpow.png differ
diff --git a/examples/compiled/bar_q_qpow.svg b/examples/compiled/bar_q_qpow.svg
new file mode 100644
index 0000000000..8e92fa51fe
--- /dev/null
+++ b/examples/compiled/bar_q_qpow.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/compiled/bar_q_qpow.vg.json b/examples/compiled/bar_q_qpow.vg.json
new file mode 100644
index 0000000000..6887375a4b
--- /dev/null
+++ b/examples/compiled/bar_q_qpow.vg.json
@@ -0,0 +1,117 @@
+{
+ "$schema": "https://vega.github.io/schema/vega/v5.json",
+ "background": "white",
+ "padding": 5,
+ "width": 200,
+ "height": 200,
+ "style": "cell",
+ "data": [
+ {
+ "name": "source_0",
+ "values": [
+ {"a": 3000, "b": 55},
+ {"a": 3500, "b": 28},
+ {"a": 4000, "b": 55}
+ ]
+ },
+ {
+ "name": "data_0",
+ "source": "source_0",
+ "transform": [
+ {
+ "type": "filter",
+ "expr": "isValid(datum[\"a\"]) && isFinite(+datum[\"a\"]) && isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])"
+ }
+ ]
+ }
+ ],
+ "marks": [
+ {
+ "name": "marks",
+ "type": "rect",
+ "style": ["bar"],
+ "from": {"data": "data_0"},
+ "encode": {
+ "update": {
+ "fill": {"value": "#4c78a8"},
+ "ariaRoleDescription": {"value": "bar"},
+ "description": {
+ "signal": "\"a: \" + (format(datum[\"a\"], \"\")) + \"; b: \" + (format(datum[\"b\"], \"\"))"
+ },
+ "xc": {"scale": "x", "field": "a"},
+ "width": {"value": 5},
+ "y": {"scale": "y", "field": "b"},
+ "y2": {"scale": "y", "value": 0}
+ }
+ }
+ }
+ ],
+ "scales": [
+ {
+ "name": "x",
+ "type": "linear",
+ "domain": {"data": "data_0", "field": "a"},
+ "range": [0, {"signal": "width"}],
+ "nice": true,
+ "zero": false,
+ "padding": 5
+ },
+ {
+ "name": "y",
+ "type": "pow",
+ "domain": {"data": "data_0", "field": "b"},
+ "range": [{"signal": "height"}, 0],
+ "nice": true,
+ "zero": true
+ }
+ ],
+ "axes": [
+ {
+ "scale": "x",
+ "orient": "bottom",
+ "gridScale": "y",
+ "grid": true,
+ "tickCount": {"signal": "ceil(width/40)"},
+ "domain": false,
+ "labels": false,
+ "aria": false,
+ "maxExtent": 0,
+ "minExtent": 0,
+ "ticks": false,
+ "zindex": 0
+ },
+ {
+ "scale": "y",
+ "orient": "left",
+ "gridScale": "x",
+ "grid": true,
+ "tickCount": {"signal": "ceil(height/40)"},
+ "domain": false,
+ "labels": false,
+ "aria": false,
+ "maxExtent": 0,
+ "minExtent": 0,
+ "ticks": false,
+ "zindex": 0
+ },
+ {
+ "scale": "x",
+ "orient": "bottom",
+ "grid": false,
+ "title": "a",
+ "labelFlush": true,
+ "labelOverlap": true,
+ "tickCount": {"signal": "ceil(width/40)"},
+ "zindex": 0
+ },
+ {
+ "scale": "y",
+ "orient": "left",
+ "grid": false,
+ "title": "b",
+ "labelOverlap": true,
+ "tickCount": {"signal": "ceil(height/40)"},
+ "zindex": 0
+ }
+ ]
+}
diff --git a/examples/specs/bar_q_qpow.vl.json b/examples/specs/bar_q_qpow.vl.json
new file mode 100644
index 0000000000..a246a6bd58
--- /dev/null
+++ b/examples/specs/bar_q_qpow.vl.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
+ "data": {
+ "values": [
+ {"a": 3000, "b": 55},
+ {"a": 3500, "b": 28},
+ {"a": 4000, "b": 55}
+ ]
+ },
+ "mark": "bar",
+ "encoding": {
+ "x": {"field": "a", "type": "quantitative"},
+ "y": {"field": "b", "type": "quantitative", "scale": {"type": "pow"}}
+ }
+}
diff --git a/src/stack.ts b/src/stack.ts
index fb4663b7c0..22fa87ce12 100644
--- a/src/stack.ts
+++ b/src/stack.ts
@@ -104,15 +104,6 @@ function potentialStackedChannel(
// if there is no explicit stacking, only apply stack if there is only one aggregate for x or y
if (xAggregate !== yAggregate) {
return xAggregate ? x : y;
- } else {
- const xScale = xDef.scale?.type;
- const yScale = yDef.scale?.type;
-
- if (xScale && xScale !== 'linear') {
- return y;
- } else if (yScale && yScale !== 'linear') {
- return x;
- }
}
if (isCartesian && mark === 'bar') {
@@ -247,7 +238,9 @@ export function stack(m: Mark | MarkDef, encoding: Encoding): StackPrope
// warn when stacking non-linear
if (stackedFieldDef?.scale?.type && stackedFieldDef?.scale?.type !== ScaleType.LINEAR) {
- log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type));
+ if (stackedFieldDef?.stack) {
+ log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type));
+ }
return null;
}
diff --git a/test/stack.test.ts b/test/stack.test.ts
index e66556691f..f8d29dc23d 100644
--- a/test/stack.test.ts
+++ b/test/stack.test.ts
@@ -234,7 +234,7 @@ describe('stack', () => {
it(
'should always warn if the aggregated axis has non-linear scale',
log.wrap(localLogger => {
- for (const s of [undefined, 'center', 'zero', 'normalize'] as const) {
+ for (const s of ['center', 'zero', 'normalize'] as const) {
for (const scaleType of [ScaleType.LOG, ScaleType.POW, ScaleType.SQRT]) {
const marks = s === undefined ? STACK_BY_DEFAULT_NON_POLAR_MARKS : STACKABLE_NON_POLAR_MARKS;
for (const mark of marks) {