diff --git a/src/traces/scattercarpet/plot.js b/src/traces/scattercarpet/plot.js index 967ea82bb16..8cce9fcb98b 100644 --- a/src/traces/scattercarpet/plot.js +++ b/src/traces/scattercarpet/plot.js @@ -37,6 +37,6 @@ module.exports = function plot(gd, plotinfoproxy, data, layer) { // separately to all scattercarpet traces, but that would require // lots of reorganization of scatter traces that is otherwise not // necessary. That makes this a potential optimization. - Drawing.setClipUrl(node, carpet._clipPathId, gd); + Drawing.setClipUrl(node, data[i][0].carpet._clipPathId, gd); } }; diff --git a/test/image/baselines/scattercarpet-on-two-carpets.png b/test/image/baselines/scattercarpet-on-two-carpets.png new file mode 100644 index 00000000000..984c5ce06bd Binary files /dev/null and b/test/image/baselines/scattercarpet-on-two-carpets.png differ diff --git a/test/image/mocks/scattercarpet-on-two-carpets.json b/test/image/mocks/scattercarpet-on-two-carpets.json new file mode 100644 index 00000000000..dbac1ca27b8 --- /dev/null +++ b/test/image/mocks/scattercarpet-on-two-carpets.json @@ -0,0 +1,66 @@ +{ + "data": [ + { + "type": "carpet", + "a": [ 4, 4, 4, 4.5, 4.5, 4.5, 5, 5, 5, 6, 6, 6 ], + "b": [ 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 ], + "y": [ 2, 3.5, 4, 3, 4.5, 5, 5.5, 6.5, 7.5, 8, 8.5, 10 ], + "aaxis": { + "tickprefix": "a = ", + "ticksuffix": "m", + "smoothing": 1, + "minorgridcount": 9 + }, + "baxis": { + "tickprefix": "b = ", + "ticksuffix": "Pa", + "smoothing": 1, + "minorgridcount": 9 + }, + "carpet": "c0" + }, + { + "type": "carpet", + "a": [ 4, 4, 4, 4.5, 4.5, 4.5, 5, 5, 5, 6, 6, 6 ], + "b": [ 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 ], + "y": [ 22, 23.5, 24, 23, 24.5, 25, 25.5, 26.5, 27.5, 28, 28.5, 30 ], + "aaxis": { + "tickprefix": "a = ", + "ticksuffix": "m", + "smoothing": 1, + "minorgridcount": 9 + }, + "baxis": { + "tickprefix": "b = ", + "ticksuffix": "Pa", + "smoothing": 1, + "minorgridcount": 9 + }, + "carpet": "c1" + }, + { + "type": "scattercarpet", + "a": [ 4, 4.5, 5, 6 ], + "b": [ 2.5, 2.5, 2.5, 2.5 ], + "line": { + "shape": "spline", + "smoothing": 1, + "color": "blue" + }, + "mode": "lines", + "carpet": "c0" + }, + { + "type": "scattercarpet", + "a": [ 4, 4.5, 5, 6 ], + "b": [ 2.5, 2.5, 2.5, 2.5 ], + "line": { + "shape": "spline", + "smoothing": 1, + "color": "red" + }, + "mode": "lines", + "carpet": "c1" + } + ] +}