@@ -2212,28 +2212,34 @@ axes.doTicks = function(gd, axid, skipTitle) {
2212
2212
2213
2213
function doAutoMargins ( ) {
2214
2214
if ( axLetter !== 'x' && axLetter !== 'y' ) { return ; }
2215
- var marginPush = 0 ;
2216
- if ( ax . automargin ) {
2217
- var axisTitleHeight = ( ax . title !== fullLayout . _dfltTitle [ axLetter ] ?
2218
- ax . titlefont . size : 0 ) ;
2219
- var axisHeight = ( axLetter === 'x' ? ax . _boundingBox . height : ax . _boundingBox . width ) ;
2220
- marginPush = axisTitleHeight + axisHeight ;
2221
- }
2222
-
2223
2215
var pushKey = ax . _name + '.automargin' ;
2216
+ var sideLetter = ax . side [ 0 ] ;
2224
2217
var existingPush = fullLayout . _pushmargin [ pushKey ] ;
2218
+ var pushParams = {
2219
+ x : sideLetter === 'r' ? ax . domain [ 1 ] : ax . domain [ 0 ] ,
2220
+ y : sideLetter === 't' ? ax . domain [ 1 ] : ax . domain [ 0 ] ,
2221
+ r : 0 , l : 0 , t : 0 , b : 0 } ;
2222
+
2223
+ if ( ! ax . automargin ) {
2224
+ if ( existingPush && ! (
2225
+ existingPush . r . size === 0 && existingPush . l . size === 0 &&
2226
+ existingPush . b . size === 0 && existingPush . t . size === 0 ) ) {
2227
+ Plots . autoMargin ( gd , pushKey , pushParams ) ;
2228
+ }
2229
+ return ;
2230
+ }
2225
2231
2226
- if ( ! fullLayout . _replotting ||
2227
- ! existingPush || existingPush [ ax . side [ 0 ] ] . size < marginPush ) {
2232
+ var axisTitleHeight = ( ax . title !== fullLayout . _dfltTitle [ axLetter ] ?
2233
+ ax . titlefont . size : 0 ) ;
2234
+ var axisHeight = ( axLetter === 'x' ?
2235
+ ax . _boundingBox . height : ax . _boundingBox . width ) ;
2236
+ var marginPush = axisTitleHeight + axisHeight ;
2228
2237
2229
- var pushParams = {
2230
- x : ax . side [ 0 ] === 'r' ? ax . domain [ 1 ] : ax . domain [ 0 ] ,
2231
- y : ax . side [ 0 ] === 't' ? ax . domain [ 1 ] : ax . domain [ 0 ] ,
2232
- r : 0 , l : 0 , t : 0 , b : 0 } ;
2233
- pushParams [ ax . side [ 0 ] ] = marginPush ;
2238
+ if ( ! fullLayout . _replotting ||
2239
+ ! existingPush || existingPush [ sideLetter ] . size < marginPush ) {
2240
+ pushParams [ sideLetter ] = marginPush ;
2234
2241
Plots . autoMargin ( gd , pushKey , pushParams ) ;
2235
2242
}
2236
-
2237
2243
}
2238
2244
2239
2245
var done = Lib . syncOrAsync ( [
0 commit comments