@@ -822,7 +822,8 @@ def set_zbound(self, lower=None, upper=None, view_margin=None):
822822 lower , upper , view_margin )
823823
824824 def _set_lim3d (self , axis , lower = None , upper = None , * , emit = True ,
825- auto = False , view_margin = None , axmin = None , axmax = None ):
825+ auto = False , view_margin = None , axmin = None , axmax = None ,
826+ minpos = np .inf ):
826827 """
827828 Set 3D axis limits.
828829 """
@@ -852,7 +853,6 @@ def _set_lim3d(self, axis, lower=None, upper=None, *, emit=True,
852853 if view_margin > 0 and hasattr (axis , '_scale' ) and axis ._scale is not None :
853854 transform = axis .get_transform ()
854855 inverse_trans = transform .inverted ()
855- minpos = max (1e-300 , abs (lower ) if lower > 0 else 1e-5 )
856856 lower , upper = axis ._scale .limit_range_for_scale (lower , upper , minpos )
857857 lower_t , upper_t = transform .transform ([lower , upper ])
858858 delta = (upper_t - lower_t ) * view_margin
@@ -935,7 +935,8 @@ def set_xlim(self, left=None, right=None, *, emit=True, auto=False,
935935 >>> set_xlim(5000, 0)
936936 """
937937 return self ._set_lim3d (self .xaxis , left , right , emit = emit , auto = auto ,
938- view_margin = view_margin , axmin = xmin , axmax = xmax )
938+ view_margin = view_margin , axmin = xmin , axmax = xmax ,
939+ minpos = self .xy_dataLim .minposx )
939940
940941 def set_ylim (self , bottom = None , top = None , * , emit = True , auto = False ,
941942 view_margin = None , ymin = None , ymax = None ):
@@ -1007,7 +1008,8 @@ def set_ylim(self, bottom=None, top=None, *, emit=True, auto=False,
10071008 >>> set_ylim(5000, 0)
10081009 """
10091010 return self ._set_lim3d (self .yaxis , bottom , top , emit = emit , auto = auto ,
1010- view_margin = view_margin , axmin = ymin , axmax = ymax )
1011+ view_margin = view_margin , axmin = ymin , axmax = ymax ,
1012+ minpos = self .xy_dataLim .minposy )
10111013
10121014 def set_zlim (self , bottom = None , top = None , * , emit = True , auto = False ,
10131015 view_margin = None , zmin = None , zmax = None ):
@@ -1079,7 +1081,8 @@ def set_zlim(self, bottom=None, top=None, *, emit=True, auto=False,
10791081 >>> set_zlim(5000, 0)
10801082 """
10811083 return self ._set_lim3d (self .zaxis , bottom , top , emit = emit , auto = auto ,
1082- view_margin = view_margin , axmin = zmin , axmax = zmax )
1084+ view_margin = view_margin , axmin = zmin , axmax = zmax ,
1085+ minpos = self .zz_dataLim .minposx )
10831086
10841087 set_xlim3d = set_xlim
10851088 set_ylim3d = set_ylim
@@ -1118,18 +1121,14 @@ def get_zlim(self):
11181121 get_zscale = _axis_method_wrapper ("zaxis" , "get_scale" )
11191122
11201123 # Custom scale setters that handle limit validation for non-linear scales
1121- def _set_axis_scale (self , axis , get_lim , set_lim , value , ** kwargs ):
1124+ def _set_axis_scale (self , axis , value , ** kwargs ):
11221125 """
11231126 Set scale for an axis and constrain limits to valid range.
11241127
11251128 Parameters
11261129 ----------
11271130 axis : Axis
11281131 The axis to set the scale on.
1129- get_lim : callable
1130- Function to get current axis limits.
1131- set_lim : callable
1132- Function to set axis limits.
11331132 value : str
11341133 The scale name.
11351134 **kwargs
@@ -1142,8 +1141,7 @@ def _set_axis_scale(self, axis, get_lim, set_lim, value, **kwargs):
11421141 # etc. This must happen before _set_axes_scale because that triggers
11431142 # autoscale_view internally.
11441143 if (axis is self .zaxis and value != 'linear'
1145- and np .array_equal (self .zz_dataLim .get_points (),
1146- [[0 , 0 ], [1 , 1 ]])):
1144+ and np .array_equal (self .zz_dataLim .get_points (), [[0 , 0 ], [1 , 1 ]])):
11471145 xymargin = 0.05 * 10 / 11
11481146 self .zz_dataLim = Bbox ([[xymargin , xymargin ],
11491147 [1 - xymargin , 1 - xymargin ]])
@@ -1164,8 +1162,7 @@ def set_xscale(self, value, **kwargs):
11641162 Keyword arguments are forwarded to the scale class.
11651163 For example, ``base=2`` can be passed when using a log scale.
11661164 """
1167- self ._set_axis_scale (self .xaxis , self .get_xlim , self .set_xlim ,
1168- value , ** kwargs )
1165+ self ._set_axis_scale (self .xaxis , value , ** kwargs )
11691166
11701167 def set_yscale (self , value , ** kwargs ):
11711168 """
@@ -1181,8 +1178,7 @@ def set_yscale(self, value, **kwargs):
11811178 Keyword arguments are forwarded to the scale class.
11821179 For example, ``base=2`` can be passed when using a log scale.
11831180 """
1184- self ._set_axis_scale (self .yaxis , self .get_ylim , self .set_ylim ,
1185- value , ** kwargs )
1181+ self ._set_axis_scale (self .yaxis , value , ** kwargs )
11861182
11871183 def set_zscale (self , value , ** kwargs ):
11881184 """
@@ -1198,8 +1194,7 @@ def set_zscale(self, value, **kwargs):
11981194 Keyword arguments are forwarded to the scale class.
11991195 For example, ``base=2`` can be passed when using a log scale.
12001196 """
1201- self ._set_axis_scale (self .zaxis , self .get_zlim , self .set_zlim ,
1202- value , ** kwargs )
1197+ self ._set_axis_scale (self .zaxis , value , ** kwargs )
12031198
12041199 get_zticks = _axis_method_wrapper ("zaxis" , "get_ticklocs" )
12051200 set_zticks = _axis_method_wrapper ("zaxis" , "set_ticks" )
@@ -1421,10 +1416,7 @@ def get_proj(self):
14211416 # transformation maps transformed coordinates (not data coordinates)
14221417 # to the unit cube
14231418 scaled_limits = self ._get_scaled_limits ()
1424- worldM = proj3d .world_transformation (
1425- * scaled_limits ,
1426- pb_aspect = box_aspect ,
1427- )
1419+ worldM = proj3d .world_transformation (* scaled_limits , pb_aspect = box_aspect )
14281420
14291421 # Look into the middle of the world coordinates:
14301422 R = 0.5 * box_aspect
0 commit comments