@@ -129,7 +129,9 @@ def __init__(
129
129
130
130
self .xy_viewLim = Bbox .unit ()
131
131
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
133
135
self .xy_dataLim = Bbox ([[xymargin , xymargin ],
134
136
[1 - xymargin , 1 - xymargin ]])
135
137
# z-limits are encoded in the x-component of the Bbox, y is un-used
@@ -159,7 +161,8 @@ def __init__(
159
161
self .set_axis_on ()
160
162
self .M = None
161
163
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
163
166
self .autoscale_view ()
164
167
165
168
# func used to format z -- fall back on major formatters
@@ -410,8 +413,9 @@ def set_box_aspect(self, aspect, *, zoom=1):
410
413
else :
411
414
aspect = np .asarray (aspect , dtype = float )
412
415
_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 )
415
419
416
420
self ._box_aspect = aspect
417
421
self .stale = True
@@ -581,17 +585,17 @@ def autoscale(self, enable=True, axis='both', tight=None):
581
585
scalez = True
582
586
else :
583
587
if axis in ['x' , 'both' ]:
584
- self .set_autoscalex_on (enable )
588
+ self .set_autoscalex_on (bool ( enable ) )
585
589
scalex = self .get_autoscalex_on ()
586
590
else :
587
591
scalex = False
588
592
if axis in ['y' , 'both' ]:
589
- self .set_autoscaley_on (enable )
593
+ self .set_autoscaley_on (bool ( enable ) )
590
594
scaley = self .get_autoscaley_on ()
591
595
else :
592
596
scaley = False
593
597
if axis in ['z' , 'both' ]:
594
- self .set_autoscalez_on (enable )
598
+ self .set_autoscalez_on (bool ( enable ) )
595
599
scalez = self .get_autoscalez_on ()
596
600
else :
597
601
scalez = False
@@ -700,20 +704,61 @@ def _set_bound3d(self, get_bound, set_lim, axis_inverted,
700
704
auto = None , view_margin = view_margin )
701
705
702
706
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
+ """
704
728
self ._set_bound3d (self .get_xbound , self .set_xlim , self .xaxis_inverted ,
705
729
lower , upper , view_margin )
706
730
707
731
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
+ """
709
753
self ._set_bound3d (self .get_ybound , self .set_ylim , self .yaxis_inverted ,
710
754
lower , upper , view_margin )
711
755
712
756
def set_zbound (self , lower = None , upper = None , view_margin = None ):
713
757
"""
714
758
Set the lower and upper numerical bounds of the z-axis.
759
+
715
760
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 ()`).
717
762
718
763
Parameters
719
764
----------
@@ -722,7 +767,7 @@ def set_zbound(self, lower=None, upper=None, view_margin=None):
722
767
is not modified.
723
768
view_margin : float or None
724
769
The margin to apply to the bounds. If *None*, the margin is handled
725
- by set_zlim.
770
+ by ` set_zlim` .
726
771
727
772
See Also
728
773
--------
@@ -737,6 +782,7 @@ def _set_lim3d(self, axis, lower=None, upper=None, *, emit=True,
737
782
auto = False , view_margin = None , axmin = None , axmax = None ):
738
783
"""
739
784
Set 3D axis limits.
785
+
740
786
See `.Axes.set_ylim` for full documentation
741
787
"""
742
788
if upper is None :
@@ -770,6 +816,7 @@ def set_xlim(self, left=None, right=None, *, emit=True, auto=False,
770
816
view_margin = None , xmin = None , xmax = None ):
771
817
"""
772
818
Set 3D x limits.
819
+
773
820
See `~.Axes.set_xlim` for full documentation
774
821
"""
775
822
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,
779
826
view_margin = None , ymin = None , ymax = None ):
780
827
"""
781
828
Set 3D y limits.
829
+
782
830
See `~.Axes.set_ylim` for full documentation
783
831
"""
784
832
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,
788
836
view_margin = None , zmin = None , zmax = None ):
789
837
"""
790
838
Set 3D z limits.
839
+
791
840
See `~.Axes.set_ylim` for full documentation
792
841
"""
793
842
return self ._set_lim3d (self .zaxis , bottom , top , emit = emit , auto = auto ,
@@ -1080,12 +1129,15 @@ def clear(self):
1080
1129
else :
1081
1130
self ._zmargin = 0.
1082
1131
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
1084
1134
self .xy_dataLim = Bbox ([[xymargin , xymargin ],
1085
1135
[1 - xymargin , 1 - xymargin ]])
1086
1136
# z-limits are encoded in the x-component of the Bbox, y is un-used
1087
1137
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
1089
1141
self .autoscale_view ()
1090
1142
1091
1143
self .grid (mpl .rcParams ['axes3d.grid' ])
@@ -2988,7 +3040,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
2988
3040
lower limits. In that case a caret symbol is used to indicate
2989
3041
this. *lims*-arguments may be scalars, or array-likes of the same
2990
3042
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
2992
3044
called before `errorbar`. Note the tricky parameter names: setting
2993
3045
e.g. *ylolims* to True means that the y-value is a *lower* limit of
2994
3046
the True value, so, only an *upward*-pointing arrow will be drawn!
0 commit comments