@@ -129,7 +129,9 @@ def __init__(
129129
130130 self .xy_viewLim = Bbox .unit ()
131131 self .zz_viewLim = Bbox .unit ()
132- xymargin = 0.05 * 10 / 11 # match mpl3.7 appearance
132+
133+ # default xymargin of 0.05 * 10/11 is to match mpl3.7 appearance
134+ xymargin = 0.045454545454545454
133135 self .xy_dataLim = Bbox ([[xymargin , xymargin ],
134136 [1 - xymargin , 1 - xymargin ]])
135137 # z-limits are encoded in the x-component of the Bbox, y is un-used
@@ -159,7 +161,8 @@ def __init__(
159161 self .set_axis_on ()
160162 self .M = None
161163
162- self ._view_margin = 1 / 48 # default value to match mpl3.7
164+ # default _view_margin is 1/48 to match mpl37
165+ self ._view_margin = 0.020833333333333332
163166 self .autoscale_view ()
164167
165168 # func used to format z -- fall back on major formatters
@@ -410,8 +413,9 @@ def set_box_aspect(self, aspect, *, zoom=1):
410413 else :
411414 aspect = np .asarray (aspect , dtype = float )
412415 _api .check_shape ((3 ,), aspect = aspect )
413- # default scale tuned to match the mpl3.2 appearance.
414- aspect *= 1.8294640721620434 * 25 / 24 * zoom / np .linalg .norm (aspect )
416+ # default scale tuned to match the mpl3.2 appearance
417+ # 1.9056917418354617 = 1.8294640721620434 * 25/24
418+ aspect *= 1.9056917418354617 * zoom / np .linalg .norm (aspect )
415419
416420 self ._box_aspect = aspect
417421 self .stale = True
@@ -581,17 +585,17 @@ def autoscale(self, enable=True, axis='both', tight=None):
581585 scalez = True
582586 else :
583587 if axis in ['x' , 'both' ]:
584- self .set_autoscalex_on (enable )
588+ self .set_autoscalex_on (bool ( enable ) )
585589 scalex = self .get_autoscalex_on ()
586590 else :
587591 scalex = False
588592 if axis in ['y' , 'both' ]:
589- self .set_autoscaley_on (enable )
593+ self .set_autoscaley_on (bool ( enable ) )
590594 scaley = self .get_autoscaley_on ()
591595 else :
592596 scaley = False
593597 if axis in ['z' , 'both' ]:
594- self .set_autoscalez_on (enable )
598+ self .set_autoscalez_on (bool ( enable ) )
595599 scalez = self .get_autoscalez_on ()
596600 else :
597601 scalez = False
@@ -700,20 +704,61 @@ def _set_bound3d(self, get_bound, set_lim, axis_inverted,
700704 auto = None , view_margin = view_margin )
701705
702706 def set_xbound (self , lower = None , upper = None , view_margin = None ):
703- # docstring inherited
707+ """
708+ Set the lower and upper numerical bounds of the x-axis.
709+
710+ This method will honor axis inversion regardless of parameter order.
711+ It will not change the autoscaling setting (`.get_autoscalex_on()`).
712+
713+ Parameters
714+ ----------
715+ lower, upper : float or None
716+ The lower and upper bounds. If *None*, the respective axis bound
717+ is not modified.
718+ view_margin : float or None
719+ The margin to apply to the bounds. If *None*, the margin is handled
720+ by `set_xlim`.
721+
722+ See Also
723+ --------
724+ get_xbound
725+ get_xlim, set_xlim
726+ invert_xaxis, xaxis_inverted
727+ """
704728 self ._set_bound3d (self .get_xbound , self .set_xlim , self .xaxis_inverted ,
705729 lower , upper , view_margin )
706730
707731 def set_ybound (self , lower = None , upper = None , view_margin = None ):
708- # docstring inherited
732+ """
733+ Set the lower and upper numerical bounds of the y-axis.
734+
735+ This method will honor axis inversion regardless of parameter order.
736+ It will not change the autoscaling setting (`.get_autoscaley_on()`).
737+
738+ Parameters
739+ ----------
740+ lower, upper : float or None
741+ The lower and upper bounds. If *None*, the respective axis bound
742+ is not modified.
743+ view_margin : float or None
744+ The margin to apply to the bounds. If *None*, the margin is handled
745+ by `set_ylim`.
746+
747+ See Also
748+ --------
749+ get_ybound
750+ get_ylim, set_ylim
751+ invert_yaxis, yaxis_inverted
752+ """
709753 self ._set_bound3d (self .get_ybound , self .set_ylim , self .yaxis_inverted ,
710754 lower , upper , view_margin )
711755
712756 def set_zbound (self , lower = None , upper = None , view_margin = None ):
713757 """
714758 Set the lower and upper numerical bounds of the z-axis.
759+
715760 This method will honor axis inversion regardless of parameter order.
716- It will not change the autoscaling setting (`.get_autoscaley_on ()`).
761+ It will not change the autoscaling setting (`.get_autoscalez_on ()`).
717762
718763 Parameters
719764 ----------
@@ -722,7 +767,7 @@ def set_zbound(self, lower=None, upper=None, view_margin=None):
722767 is not modified.
723768 view_margin : float or None
724769 The margin to apply to the bounds. If *None*, the margin is handled
725- by set_zlim.
770+ by ` set_zlim` .
726771
727772 See Also
728773 --------
@@ -737,6 +782,7 @@ def _set_lim3d(self, axis, lower=None, upper=None, *, emit=True,
737782 auto = False , view_margin = None , axmin = None , axmax = None ):
738783 """
739784 Set 3D axis limits.
785+
740786 See `.Axes.set_ylim` for full documentation
741787 """
742788 if upper is None :
@@ -770,6 +816,7 @@ def set_xlim(self, left=None, right=None, *, emit=True, auto=False,
770816 view_margin = None , xmin = None , xmax = None ):
771817 """
772818 Set 3D x limits.
819+
773820 See `~.Axes.set_xlim` for full documentation
774821 """
775822 return self ._set_lim3d (self .xaxis , left , right , emit = emit , auto = auto ,
@@ -779,6 +826,7 @@ def set_ylim(self, bottom=None, top=None, *, emit=True, auto=False,
779826 view_margin = None , ymin = None , ymax = None ):
780827 """
781828 Set 3D y limits.
829+
782830 See `~.Axes.set_ylim` for full documentation
783831 """
784832 return self ._set_lim3d (self .yaxis , bottom , top , emit = emit , auto = auto ,
@@ -788,6 +836,7 @@ def set_zlim(self, bottom=None, top=None, *, emit=True, auto=False,
788836 view_margin = None , zmin = None , zmax = None ):
789837 """
790838 Set 3D z limits.
839+
791840 See `~.Axes.set_ylim` for full documentation
792841 """
793842 return self ._set_lim3d (self .zaxis , bottom , top , emit = emit , auto = auto ,
@@ -1080,12 +1129,15 @@ def clear(self):
10801129 else :
10811130 self ._zmargin = 0.
10821131
1083- xymargin = 0.05 * 10 / 11 # match mpl3.7 appearance
1132+ # default xymargin of 0.05 * 10/11 is to match mpl3.7 appearance
1133+ xymargin = 0.045454545454545454
10841134 self .xy_dataLim = Bbox ([[xymargin , xymargin ],
10851135 [1 - xymargin , 1 - xymargin ]])
10861136 # z-limits are encoded in the x-component of the Bbox, y is un-used
10871137 self .zz_dataLim = Bbox .unit ()
1088- self ._view_margin = 1 / 48 # default value to match mpl3.7
1138+
1139+ # default _view_margin is 1/48 to match mpl37
1140+ self ._view_margin = 0.020833333333333333
10891141 self .autoscale_view ()
10901142
10911143 self .grid (mpl .rcParams ['axes3d.grid' ])
@@ -2988,7 +3040,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
29883040 lower limits. In that case a caret symbol is used to indicate
29893041 this. *lims*-arguments may be scalars, or array-likes of the same
29903042 length as the errors. To use limits with inverted axes,
2991- `~.Axes.set_xlim`, `~.Axes.set_ylim`, or `~.Axes.set_ylim ` must be
3043+ `~.Axes.set_xlim`, `~.Axes.set_ylim`, or `~.Axes.set_zlim ` must be
29923044 called before `errorbar`. Note the tricky parameter names: setting
29933045 e.g. *ylolims* to True means that the y-value is a *lower* limit of
29943046 the True value, so, only an *upward*-pointing arrow will be drawn!
0 commit comments