@@ -405,15 +405,21 @@ def margins(self, *args, **kw):
405
405
mx = kw .pop ('x' , None )
406
406
my = kw .pop ('y' , None )
407
407
mz = kw .pop ('z' , None )
408
- if len (args ) == 1 :
408
+ if not args :
409
+ pass
410
+ elif len (args ) == 1 :
409
411
mx = my = mz = args [0 ]
410
412
elif len (args ) == 2 :
411
- # Maybe put out a warning because mz is not set?
413
+ warnings .warn (
414
+ "Passing exactly two positional arguments to Axes3D.margins "
415
+ "is deprecated. If needed, pass them as keyword arguments "
416
+ "instead" , cbook .mplDeprecation )
412
417
mx , my = args
413
418
elif len (args ) == 3 :
414
419
mx , my , mz = args
415
420
else :
416
- raise ValueError ("more than three arguments were supplied" )
421
+ raise ValueError (
422
+ "Axes3D.margins takes at most three positional arguments" )
417
423
if mx is not None :
418
424
self .set_xmargin (mx )
419
425
if my is not None :
@@ -444,18 +450,18 @@ def autoscale(self, enable=True, axis='both', tight=None):
444
450
scaley = True
445
451
scalez = True
446
452
else :
447
- scalex = False
448
- scaley = False
449
- scalez = False
450
453
if axis in ['x' , 'both' ]:
451
- self ._autoscaleXon = bool (enable )
452
- scalex = self ._autoscaleXon
454
+ self ._autoscaleXon = scalex = bool (enable )
455
+ else :
456
+ scalex = False
453
457
if axis in ['y' , 'both' ]:
454
- self ._autoscaleYon = bool (enable )
455
- scaley = self ._autoscaleYon
458
+ self ._autoscaleYon = scaley = bool (enable )
459
+ else :
460
+ scaley = False
456
461
if axis in ['z' , 'both' ]:
457
- self ._autoscaleZon = bool (enable )
458
- scalez = self ._autoscaleZon
462
+ self ._autoscaleZon = scalez = bool (enable )
463
+ else :
464
+ scalez = False
459
465
self .autoscale_view (tight = tight , scalex = scalex , scaley = scaley ,
460
466
scalez = scalez )
461
467
0 commit comments