diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index 722e95e06a2..2f3c4c7f59c 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -1942,7 +1942,7 @@ axes.drawOne = function(gd, ax, opts) { ax.title.font.size; } - if(ax.mirror) { + if(ax.mirror && ax.anchor !== 'free') { mirrorPush = {x: 0, y: 0, r: 0, l: 0, t: 0, b: 0}; mirrorPush[sMirror] = ax.linewidth; diff --git a/src/plots/plots.js b/src/plots/plots.js index cb11473468b..a76591fb702 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -927,7 +927,7 @@ plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLa // this loop can be costly, so only compute it when required if(ax._counterAxes.length && ( (ax.spikemode && ax.spikemode.indexOf('across') !== -1) || - (ax.automargin && ax.mirror) || + (ax.automargin && ax.mirror && ax.anchor !== 'free') || Registry.getComponentMethod('rangeslider', 'isVisible')(ax) )) { var min = 1; diff --git a/test/jasmine/tests/axes_test.js b/test/jasmine/tests/axes_test.js index d5539ab00fe..e51bd397ead 100644 --- a/test/jasmine/tests/axes_test.js +++ b/test/jasmine/tests/axes_test.js @@ -3468,6 +3468,33 @@ describe('Test axes', function() { .catch(failTest) .then(done); }); + + it('should handle cases with free+mirror axes', function(done) { + Plotly.plot(gd, [{ + y: [1, 2, 1] + }], { + xaxis: { + ticks: 'outside', + mirror: 'ticks', + anchor: 'free', + automargin: true + }, + yaxis: { + showline: true, + linewidth: 2, + mirror: 'all', + anchor: 'free', + automargin: true + } + }) + .then(function() { + // N.B. no '.automargin.mirror' + expect(Object.keys(gd._fullLayout._pushmargin)) + .toEqual(['x.automargin', 'y.automargin', 'base']); + }) + .catch(failTest) + .then(done); + }); }); describe('zeroline visibility logic', function() { diff --git a/test/jasmine/tests/transition_test.js b/test/jasmine/tests/transition_test.js index 39660a076b8..0bbef67eb53 100644 --- a/test/jasmine/tests/transition_test.js +++ b/test/jasmine/tests/transition_test.js @@ -1189,7 +1189,7 @@ describe('Plotly.react transitions:', function() { .then(done); }); - it('should update ranges of date and category axes', function(done) { + it('@flaky should update ranges of date and category axes', function(done) { Plotly.plot(gd, [ {x: ['2018-01-01', '2019-01-01', '2020-01-01'], y: [1, 2, 3]}, {x: ['a', 'b', 'c'], y: [1, 2, 3], xaxis: 'x2', yaxis: 'y2'}