29
29
import matplotlib .docstring as docstring
30
30
import matplotlib .scale as mscale
31
31
import matplotlib .transforms as mtransforms
32
+ import matplotlib .units as munits
32
33
from matplotlib .axes import Axes , rcParams
33
34
from matplotlib .colors import Normalize , LightSource
34
35
from matplotlib .transforms import Bbox
@@ -609,6 +610,7 @@ def _determine_lims(self, xmin=None, xmax=None, *args, **kwargs):
609
610
xmax += 0.05
610
611
return (xmin , xmax )
611
612
613
+ @munits ._accepts_units (convert_x = ['left' , 'right' ])
612
614
def set_xlim3d (self , left = None , right = None , emit = True , auto = False , ** kw ):
613
615
"""
614
616
Set 3D x limits.
@@ -626,9 +628,8 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw):
626
628
if right is None and cbook .iterable (left ):
627
629
left , right = left
628
630
629
- self ._process_unit_info (xdata = (left , right ))
630
- left = self ._validate_converted_limits (left , self .convert_xunits )
631
- right = self ._validate_converted_limits (right , self .convert_xunits )
631
+ self ._validate_converted_limits (left )
632
+ self ._validate_converted_limits (right )
632
633
633
634
old_left , old_right = self .get_xlim ()
634
635
if left is None :
@@ -661,6 +662,7 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw):
661
662
return left , right
662
663
set_xlim = set_xlim3d
663
664
665
+ @munits ._accepts_units (convert_y = ['bottom' , 'top' ])
664
666
def set_ylim3d (self , bottom = None , top = None , emit = True , auto = False , ** kw ):
665
667
"""
666
668
Set 3D y limits.
@@ -678,9 +680,8 @@ def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
678
680
if top is None and cbook .iterable (bottom ):
679
681
bottom , top = bottom
680
682
681
- self ._process_unit_info (ydata = (bottom , top ))
682
- bottom = self ._validate_converted_limits (bottom , self .convert_yunits )
683
- top = self ._validate_converted_limits (top , self .convert_yunits )
683
+ self ._validate_converted_limits (bottom )
684
+ self ._validate_converted_limits (top )
684
685
685
686
old_bottom , old_top = self .get_ylim ()
686
687
if bottom is None :
@@ -731,8 +732,10 @@ def set_zlim3d(self, bottom=None, top=None, emit=True, auto=False, **kw):
731
732
bottom , top = bottom
732
733
733
734
self ._process_unit_info (zdata = (bottom , top ))
734
- bottom = self ._validate_converted_limits (bottom , self .convert_zunits )
735
- top = self ._validate_converted_limits (top , self .convert_zunits )
735
+ bottom = self .convert_zunits (bottom )
736
+ top = self .convert_zunits (top )
737
+ self ._validate_converted_limits (bottom )
738
+ self ._validate_converted_limits (top )
736
739
737
740
old_bottom , old_top = self .get_zlim ()
738
741
if bottom is None :
0 commit comments