diff --git a/src/traces/sankey/render.js b/src/traces/sankey/render.js index f084f46275a..530b7b95518 100644 --- a/src/traces/sankey/render.js +++ b/src/traces/sankey/render.js @@ -172,7 +172,7 @@ function sankeyModel(layout, d, traceIndex) { valueFormat: valueFormat, valueSuffix: valueSuffix, textFont: textFont, - translateX: domain.x[0] * width + layout.margin.l, + translateX: domain.x[0] * layout.width + layout.margin.l, translateY: layout.height - domain.y[1] * layout.height + layout.margin.t, dragParallel: horizontal ? height : width, dragPerpendicular: horizontal ? width : height, diff --git a/test/image/baselines/sankey_subplots.png b/test/image/baselines/sankey_subplots.png new file mode 100644 index 00000000000..5034eade547 Binary files /dev/null and b/test/image/baselines/sankey_subplots.png differ diff --git a/test/image/mocks/sankey_subplots.json b/test/image/mocks/sankey_subplots.json new file mode 100644 index 00000000000..fe20a584f86 --- /dev/null +++ b/test/image/mocks/sankey_subplots.json @@ -0,0 +1,46 @@ +{ + "data": [{ + "domain": { + "x": [0, 0.45] + }, + "type": "sankey", + "orientation": "h", + "node": { + "line": { + "color": "black" + }, + "label": ["el1", "el2", "el3"] + }, + "link": { + "source": [0, 2], + "target": [1, 1], + "value": [120, 50], + "label": ["stram1", "stream2"] + } + }, + { + "domain": { + "x": [0.55, 1] + }, + "type": "sankey", + "orientation": "h", + "node": { + "line": { + "color": "black" + }, + "label": ["el4", "el5", "el6"] + }, + "link": { + "source": [0, 2], + "target": [1, 1], + "value": [120, 50], + "label": ["stram4", "stream5"] + } + } + ], + "layout": { + "title": "Multiple Sankey plots", + "autosize": true, + "showlegend": false + } +}