@@ -2223,12 +2223,9 @@ axes.doTicks = function(gd, axid, skipTitle) {
22232223 var pushKey = ax . _name + '.automargin' ;
22242224 var sideLetter = ax . side [ 0 ] ;
22252225 var existingPush = fullLayout . _pushmargin [ pushKey ] ;
2226- var pushParams = {
2227- x : sideLetter === 'r' ? ax . domain [ 1 ] : ax . domain [ 0 ] ,
2228- y : sideLetter === 't' ? ax . domain [ 1 ] : ax . domain [ 0 ] ,
2229- r : 0 , l : 0 , t : 0 , b : 0 } ;
2226+ var pushParams = { x : 0 , y : 0 , r : 0 , l : 0 , t : 0 , b : 0 } ;
22302227
2231- if ( ! ax . automargin ) {
2228+ if ( ! ax . automargin || ax . anchor === 'free' || ! ax . _anchorAxis ) {
22322229 if ( existingPush && ! (
22332230 existingPush . r . size === 0 && existingPush . l . size === 0 &&
22342231 existingPush . b . size === 0 && existingPush . t . size === 0 ) ) {
@@ -2237,11 +2234,18 @@ axes.doTicks = function(gd, axid, skipTitle) {
22372234 return ;
22382235 }
22392236
2240- var axisTitleHeight = ( ax . title !== fullLayout . _dfltTitle [ axLetter ] ?
2237+ var axisDim ;
2238+ if ( axLetter === 'x' ) {
2239+ pushParams . y = ax . _anchorAxis . domain [ sideLetter === 't' ? 1 : 0 ] ;
2240+ axisDim = ax . _boundingBox . height ;
2241+ }
2242+ else {
2243+ pushParams . x = ax . _anchorAxis . domain [ sideLetter === 'r' ? 1 : 0 ] ;
2244+ axisDim = ax . _boundingBox . width ;
2245+ }
2246+ var axisTitleDim = ( ax . title !== fullLayout . _dfltTitle [ axLetter ] ?
22412247 ax . titlefont . size : 0 ) ;
2242- var axisHeight = ( axLetter === 'x' ?
2243- ax . _boundingBox . height : ax . _boundingBox . width ) ;
2244- var marginPush = axisTitleHeight + axisHeight ;
2248+ var marginPush = axisTitleDim + axisDim ;
22452249
22462250 if ( ! fullLayout . _replotting ||
22472251 ! existingPush || existingPush [ sideLetter ] . size < marginPush ) {
0 commit comments