@@ -405,15 +405,21 @@ def margins(self, *args, **kw):
405405 mx = kw .pop ('x' , None )
406406 my = kw .pop ('y' , None )
407407 mz = kw .pop ('z' , None )
408- if len (args ) == 1 :
408+ if not args :
409+ pass
410+ elif len (args ) == 1 :
409411 mx = my = mz = args [0 ]
410412 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 )
412417 mx , my = args
413418 elif len (args ) == 3 :
414419 mx , my , mz = args
415420 else :
416- raise ValueError ("more than three arguments were supplied" )
421+ raise ValueError (
422+ "Axes3D.margins takes at most three positional arguments" )
417423 if mx is not None :
418424 self .set_xmargin (mx )
419425 if my is not None :
@@ -444,18 +450,18 @@ def autoscale(self, enable=True, axis='both', tight=None):
444450 scaley = True
445451 scalez = True
446452 else :
447- scalex = False
448- scaley = False
449- scalez = False
450453 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
453457 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
456461 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
459465 self .autoscale_view (tight = tight , scalex = scalex , scaley = scaley ,
460466 scalez = scalez )
461467
0 commit comments