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

Skip to content

Commit 8d60d54

Browse files
authored
Merge pull request #9969 from timhoffm/axesbase-doc-cleanup
Numpydoc conversion and clarification of some AxesBase docstrings
2 parents e68e9dc + d863b72 commit 8d60d54

File tree

1 file changed

+33
-18
lines changed

1 file changed

+33
-18
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,6 +2217,12 @@ def set_xmargin(self, m):
22172217
22182218
*m* times the data interval will be added to each
22192219
end of that interval before it is used in autoscaling.
2220+
For example, if your data is in the range [0, 2], a factor of
2221+
``m = 0.1`` will result in a range [-0.2, 2.2].
2222+
2223+
Negative values -0.5 < m < 0 will result in clipping of the data range.
2224+
I.e. for a data range [0, 2], a factor of ``m = -0.1`` will result in
2225+
a range [0.2, 1.8].
22202226
22212227
..
22222228
ACCEPTS: float greater than -0.5
@@ -2236,6 +2242,12 @@ def set_ymargin(self, m):
22362242
22372243
*m* times the data interval will be added to each
22382244
end of that interval before it is used in autoscaling.
2245+
For example, if your data is in the range [0, 2], a factor of
2246+
``m = 0.1`` will result in a range [-0.2, 2.2].
2247+
2248+
Negative values -0.5 < m < 0 will result in clipping of the data range.
2249+
I.e. for a data range [0, 2], a factor of ``m = -0.1`` will result in
2250+
a range [0.2, 1.8].
22392251
22402252
..
22412253
ACCEPTS: float greater than -0.5
@@ -2333,23 +2345,23 @@ def autoscale(self, enable=True, axis='both', tight=None):
23332345
if autoscaling for either axis is on, it performs
23342346
the autoscaling on the specified axis or axes.
23352347
2336-
*enable*: [True | False | None]
2348+
Parameters
2349+
----------
2350+
enable : [True | False | None], optional
23372351
True (default) turns autoscaling on, False turns it off.
23382352
None leaves the autoscaling state unchanged.
23392353
2340-
*axis*: ['x' | 'y' | 'both']
2354+
axis : ['both' | 'x' | 'y'], optional
23412355
which axis to operate on; default is 'both'
23422356
2343-
*tight*: [True | False | None]
2357+
tight: [None | True | False], optional
23442358
If True, set view limits to data limits;
23452359
if False, let the locator and margins expand the view limits;
23462360
if None, use tight scaling if the only artist is an image,
23472361
otherwise treat *tight* as False.
23482362
The *tight* setting is retained for future autoscaling
23492363
until it is explicitly changed.
23502364
2351-
2352-
Returns None.
23532365
"""
23542366
if enable is None:
23552367
scalex = True
@@ -2371,8 +2383,9 @@ def autoscale(self, enable=True, axis='both', tight=None):
23712383

23722384
def autoscale_view(self, tight=None, scalex=True, scaley=True):
23732385
"""
2374-
Autoscale the view limits using the data limits. You can
2375-
selectively autoscale only a single axis, e.g., the xaxis by
2386+
Autoscale the view limits using the data limits.
2387+
2388+
You can selectively autoscale only a single axis, e.g., the xaxis by
23762389
setting *scaley* to *False*. The autoscaling preserves any
23772390
axis direction reversal that has already been done.
23782391
@@ -2761,18 +2774,20 @@ def locator_params(self, axis='both', tight=None, **kwargs):
27612774
"""
27622775
Control behavior of tick locators.
27632776
2764-
Keyword arguments:
2765-
2766-
*axis*
2767-
['x' | 'y' | 'both'] Axis on which to operate;
2768-
default is 'both'.
2777+
Parameters
2778+
----------
2779+
axis : ['both' | 'x' | 'y'], optional
2780+
The axis on which to operate.
27692781
2770-
*tight*
2771-
[True | False | None] Parameter passed to :meth:`autoscale_view`.
2782+
tight : [None | True | False], optional
2783+
Parameter passed to :meth:`autoscale_view`.
27722784
Default is None, for no change.
27732785
2774-
Remaining keyword arguments are passed to directly to the
2775-
:meth:`~matplotlib.ticker.MaxNLocator.set_params` method.
2786+
Other Parameters
2787+
----------------
2788+
**kw :
2789+
Remaining keyword arguments are passed to directly to the
2790+
:meth:`~matplotlib.ticker.MaxNLocator.set_params` method.
27762791
27772792
Typically one might want to reduce the maximum number
27782793
of ticks and use tight bounds when plotting small
@@ -4217,9 +4232,9 @@ def twiny(self):
42174232
return ax2
42184233

42194234
def get_shared_x_axes(self):
4220-
'Return a copy of the shared axes Grouper object for x axes'
4235+
"""Return a copy of the shared axes Grouper object for x axes."""
42214236
return self._shared_x_axes
42224237

42234238
def get_shared_y_axes(self):
4224-
'Return a copy of the shared axes Grouper object for y axes'
4239+
"""Return a copy of the shared axes Grouper object for y axes."""
42254240
return self._shared_y_axes

0 commit comments

Comments
 (0)