@@ -206,9 +206,11 @@ function makePadFn(ax, max) {
206206 // 5% padding for points that specify extrapad: true
207207 var extrappad = 0.05 * ax . _length ;
208208
209+ var anchorAxis = ax . _anchorAxis || { } ;
210+
209211 if (
210212 ( ax . ticklabelposition || '' ) . indexOf ( 'inside' ) !== - 1 ||
211- ( ( ax . _anchorAxis || { } ) . ticklabelposition || '' ) . indexOf ( 'inside' ) !== - 1
213+ ( anchorAxis . ticklabelposition || '' ) . indexOf ( 'inside' ) !== - 1
212214 ) {
213215 var axReverse = ax . autorange === 'reversed' ;
214216 if ( ! axReverse ) {
@@ -218,8 +220,16 @@ function makePadFn(ax, max) {
218220 if ( axReverse ) max = ! max ;
219221 }
220222
221- var A = padInsideLabelsOnAnchorAxis ( ax , max ) ;
222- var B = padInsideLabelsOnThisAxis ( ax , max ) ;
223+ var A = 0 ;
224+ var B = 0 ;
225+
226+ if (
227+ ! anchorAxis . matches && ! ax . matches &&
228+ ! anchorAxis . scaleanchor && ! ax . scaleanchor
229+ ) {
230+ A = padInsideLabelsOnAnchorAxis ( ax , max ) ;
231+ B = padInsideLabelsOnThisAxis ( ax , max ) ;
232+ }
223233
224234 var zero = Math . max ( A , B ) ;
225235 extrappad = Math . max ( zero , extrappad ) ;
@@ -273,7 +283,7 @@ function padInsideLabelsOnThisAxis(ax, max) {
273283
274284function padInsideLabelsOnAnchorAxis ( ax , max ) {
275285 var pad = 0 ;
276- var anchorAxis = ( ax . _anchorAxis || { } ) ;
286+ var anchorAxis = ax . _anchorAxis || { } ;
277287 if ( ( anchorAxis . ticklabelposition || '' ) . indexOf ( 'inside' ) !== - 1 ) {
278288 // increase padding to make more room for inside tick labels of the counter axis
279289 if ( (
0 commit comments