@@ -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 TypeError (
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 :
@@ -448,14 +454,17 @@ def autoscale(self, enable=True, axis='both', tight=None):
448
454
scaley = False
449
455
scalez = False
450
456
if axis in ['x' , 'both' ]:
451
- self ._autoscaleXon = bool (enable )
452
- scalex = self ._autoscaleXon
457
+ self ._autoscaleXon = scalex = bool (enable )
458
+ else :
459
+ scalex = False
453
460
if axis in ['y' , 'both' ]:
454
- self ._autoscaleYon = bool (enable )
455
- scaley = self ._autoscaleYon
461
+ self ._autoscaleYon = scaley = bool (enable )
462
+ else :
463
+ scaly = False
456
464
if axis in ['z' , 'both' ]:
457
- self ._autoscaleZon = bool (enable )
458
- scalez = self ._autoscaleZon
465
+ self ._autoscaleZon = scalez = bool (enable )
466
+ else :
467
+ scalez = False
459
468
self .autoscale_view (tight = tight , scalex = scalex , scaley = scaley ,
460
469
scalez = scalez )
461
470
0 commit comments