Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e923164

Browse files
committed
Reword margins docstrings, and fix bounds on zmargin values.
The bounds on zmargin values can match those on x/ymargins.
1 parent 2c3f14e commit e923164

2 files changed

Lines changed: 24 additions & 19 deletions

File tree

lib/matplotlib/axes/_base.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,14 +2618,13 @@ def set_xmargin(self, m):
26182618
"""
26192619
Set padding of X data limits prior to autoscaling.
26202620
2621-
*m* times the data interval will be added to each
2622-
end of that interval before it is used in autoscaling.
2623-
For example, if your data is in the range [0, 2], a factor of
2624-
``m = 0.1`` will result in a range [-0.2, 2.2].
2621+
*m* times the data interval will be added to each end of that interval
2622+
before it is used in autoscaling. If *m* is negative, this will clip
2623+
the data range instead of expanding it.
26252624
2626-
Negative values -0.5 < m < 0 will result in clipping of the data range.
2627-
I.e. for a data range [0, 2], a factor of ``m = -0.1`` will result in
2628-
a range [0.2, 1.8].
2625+
For example, if your data is in the range [0, 2], a margin of 0.1 will
2626+
result in a range [-0.2, 2.2]; a margin of -0.1 will result in a range
2627+
of [0.2, 1.8].
26292628
26302629
Parameters
26312630
----------
@@ -2641,14 +2640,13 @@ def set_ymargin(self, m):
26412640
"""
26422641
Set padding of Y data limits prior to autoscaling.
26432642
2644-
*m* times the data interval will be added to each
2645-
end of that interval before it is used in autoscaling.
2646-
For example, if your data is in the range [0, 2], a factor of
2647-
``m = 0.1`` will result in a range [-0.2, 2.2].
2643+
*m* times the data interval will be added to each end of that interval
2644+
before it is used in autoscaling. If *m* is negative, this will clip
2645+
the data range instead of expanding it.
26482646
2649-
Negative values -0.5 < m < 0 will result in clipping of the data range.
2650-
I.e. for a data range [0, 2], a factor of ``m = -0.1`` will result in
2651-
a range [0.2, 1.8].
2647+
For example, if your data is in the range [0, 2], a margin of 0.1 will
2648+
result in a range [-0.2, 2.2]; a margin of -0.1 will result in a range
2649+
of [0.2, 1.8].
26522650
26532651
Parameters
26542652
----------

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,13 +536,20 @@ def set_zmargin(self, m):
536536
"""
537537
Set padding of Z data limits prior to autoscaling.
538538
539-
*m* times the data interval will be added to each
540-
end of that interval before it is used in autoscaling.
539+
*m* times the data interval will be added to each end of that interval
540+
before it is used in autoscaling. If *m* is negative, this will clip
541+
the data range instead of expanding it.
541542
542-
accepts: float in range 0 to 1
543+
For example, if your data is in the range [0, 2], a margin of 0.1 will
544+
result in a range [-0.2, 2.2]; a margin of -0.1 will result in a range
545+
of [0.2, 1.8].
546+
547+
Parameters
548+
----------
549+
m : float greater than -0.5
543550
"""
544-
if m < 0 or m > 1:
545-
raise ValueError("margin must be in range 0 to 1")
551+
if m <= -0.5:
552+
raise ValueError("margin must be greater than -0.5")
546553
self._zmargin = m
547554
self._request_autoscale_view(scalex=False, scaley=False, scalez=True)
548555
self.stale = True

0 commit comments

Comments
 (0)