@@ -2223,12 +2223,9 @@ axes.doTicks = function(gd, axid, skipTitle) {
2223
2223
var pushKey = ax . _name + '.automargin' ;
2224
2224
var sideLetter = ax . side [ 0 ] ;
2225
2225
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 } ;
2230
2227
2231
- if ( ! ax . automargin ) {
2228
+ if ( ! ax . automargin || ax . anchor === 'free' || ! ax . _anchorAxis ) {
2232
2229
if ( existingPush && ! (
2233
2230
existingPush . r . size === 0 && existingPush . l . size === 0 &&
2234
2231
existingPush . b . size === 0 && existingPush . t . size === 0 ) ) {
@@ -2237,11 +2234,18 @@ axes.doTicks = function(gd, axid, skipTitle) {
2237
2234
return ;
2238
2235
}
2239
2236
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 ] ?
2241
2247
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 ;
2245
2249
2246
2250
if ( ! fullLayout . _replotting ||
2247
2251
! existingPush || existingPush [ sideLetter ] . size < marginPush ) {
0 commit comments