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

Skip to content

Commit 3b3fb2a

Browse files
committed
Tweak Axes3D docstrings that refer to 2D plotting methods.
... and minor edits to 2D Axes.margins docs as well.
1 parent eda1404 commit 3b3fb2a

2 files changed

Lines changed: 26 additions & 64 deletions

File tree

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,11 +2705,11 @@ def margins(self, *margins, x=None, y=None, tight=True):
27052705
only the y-axis.
27062706
27072707
tight : bool or None, default: True
2708-
The *tight* parameter is passed to :meth:`autoscale_view`,
2708+
The *tight* parameter is passed to `autoscale_view`,
27092709
which is executed after a margin is changed; the default
27102710
here is *True*, on the assumption that when margins are
27112711
specified, no additional padding to match tick marks is
2712-
usually desired. Set *tight* to *None* will preserve
2712+
usually desired. Setting *tight* to *None* preserves
27132713
the previous setting.
27142714
27152715
Returns

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 24 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -510,41 +510,11 @@ def set_zmargin(self, m):
510510

511511
def margins(self, *margins, x=None, y=None, z=None, tight=True):
512512
"""
513-
Convenience method to set or retrieve autoscaling margins.
513+
Set or retrieve autoscaling margins.
514514
515-
Call signatures::
516-
517-
margins()
518-
519-
returns xmargin, ymargin, zmargin
520-
521-
::
522-
523-
margins(margin)
524-
525-
margins(xmargin, ymargin, zmargin)
526-
527-
margins(x=xmargin, y=ymargin, z=zmargin)
528-
529-
margins(..., tight=False)
530-
531-
All forms above set the xmargin, ymargin and zmargin
532-
parameters. All keyword parameters are optional. A single
533-
positional argument specifies xmargin, ymargin and zmargin.
534-
Passing both positional and keyword arguments for xmargin,
535-
ymargin, and/or zmargin is invalid.
536-
537-
The *tight* parameter
538-
is passed to :meth:`autoscale_view`, which is executed after
539-
a margin is changed; the default here is *True*, on the
540-
assumption that when margins are specified, no additional
541-
padding to match tick marks is usually desired. Setting
542-
*tight* to *None* will preserve the previous setting.
543-
544-
Specifying any margin changes only the autoscaling; for example,
545-
if *xmargin* is not None, then *xmargin* times the X data
546-
interval will be added to each end of that interval before
547-
it is used in autoscaling.
515+
See `.Axes.margins` for full documentation. Because this function
516+
applies to 3D Axes, it also takes a *z* argument, and returns
517+
``(xmargin, ymargin, zmargin)``.
548518
"""
549519
if margins and x is not None and y is not None and z is not None:
550520
raise TypeError('Cannot pass both positional and keyword '
@@ -577,10 +547,10 @@ def margins(self, *margins, x=None, y=None, z=None, tight=True):
577547
def autoscale(self, enable=True, axis='both', tight=None):
578548
"""
579549
Convenience method for simple axis view autoscaling.
580-
See :meth:`matplotlib.axes.Axes.autoscale` for full explanation.
581-
Note that this function behaves the same, but for all
582-
three axes. Therefore, 'z' can be passed for *axis*,
583-
and 'both' applies to all three axes.
550+
551+
See `.Axes.autoscale` for full documentation. Because this function
552+
applies to 3D Axes, *axis* can also be set to 'z', and setting *axis*
553+
to 'both' autoscales all three axes.
584554
"""
585555
if enable is None:
586556
scalex = True
@@ -624,9 +594,9 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True,
624594
scalez=True):
625595
"""
626596
Autoscale the view limits using the data limits.
627-
See :meth:`matplotlib.axes.Axes.autoscale_view` for documentation.
628-
Note that this function applies to the 3D axes, and as such
629-
adds the *scalez* to the function arguments.
597+
598+
See `.Axes.autoscale_view` for full documentation. Because this
599+
function applies to 3D Axes, it also takes a *scalez* argument.
630600
"""
631601
# This method looks at the rectangular volume (see above)
632602
# of data and decides how to scale the view portal to fit it.
@@ -694,7 +664,7 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False,
694664
"""
695665
Set 3D x limits.
696666
697-
See :meth:`matplotlib.axes.Axes.set_xlim` for full documentation.
667+
See `.Axes.set_xlim` for full documentation.
698668
"""
699669
if right is None and np.iterable(left):
700670
left, right = left
@@ -751,7 +721,7 @@ def set_ylim3d(self, bottom=None, top=None, emit=True, auto=False,
751721
"""
752722
Set 3D y limits.
753723
754-
See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation.
724+
See `.Axes.set_ylim` for full documentation.
755725
"""
756726
if top is None and np.iterable(bottom):
757727
bottom, top = bottom
@@ -809,7 +779,7 @@ def set_zlim3d(self, bottom=None, top=None, emit=True, auto=False,
809779
"""
810780
Set 3D z limits.
811781
812-
See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation
782+
See `.Axes.set_ylim` for full documentation
813783
"""
814784
if top is None and np.iterable(bottom):
815785
bottom, top = bottom
@@ -1358,8 +1328,8 @@ def grid(self, visible=True, **kwargs):
13581328
.. note::
13591329
13601330
Currently, this function does not behave the same as
1361-
:meth:`matplotlib.axes.Axes.grid`, but it is intended to
1362-
eventually support that behavior.
1331+
`.axes.Axes.grid`, but it is intended to eventually support that
1332+
behavior.
13631333
"""
13641334
# TODO: Operate on each axes separately
13651335
if len(kwargs):
@@ -1372,13 +1342,9 @@ def tick_params(self, axis='both', **kwargs):
13721342
Convenience method for changing the appearance of ticks and
13731343
tick labels.
13741344
1375-
See :meth:`matplotlib.axes.Axes.tick_params` for more complete
1376-
documentation.
1377-
1378-
The only difference is that setting *axis* to 'both' will
1379-
mean that the settings are applied to all three axes. Also,
1380-
the *axis* parameter also accepts a value of 'z', which
1381-
would mean to apply to only the z-axis.
1345+
See `.Axes.tick_params` for full documentation. Because this function
1346+
applies to 3D Axes, *axis* can also be set to 'z', and setting *axis*
1347+
to 'both' autoscales all three axes.
13821348
13831349
Also, because of how Axes3D objects are drawn very differently
13841350
from regular 2D axes, some of these settings may have
@@ -2104,8 +2070,7 @@ def contour(self, X, Y, Z, *args,
21042070
Parameters
21052071
----------
21062072
X, Y, Z : array-like,
2107-
Input data. See `~matplotlib.axes.Axes.contour` for acceptable
2108-
data shapes.
2073+
Input data. See `.Axes.contour` for supported data shapes.
21092074
extend3d : bool, default: False
21102075
Whether to extend contour in 3D.
21112076
stride : int
@@ -2149,8 +2114,7 @@ def tricontour(self, *args,
21492114
Parameters
21502115
----------
21512116
X, Y, Z : array-like
2152-
Input data. See `~matplotlib.axes.Axes.tricontour` for acceptable
2153-
data shapes.
2117+
Input data. See `.Axes.tricontour` for supported data shapes.
21542118
extend3d : bool, default: False
21552119
Whether to extend contour in 3D.
21562120
stride : int
@@ -2208,8 +2172,7 @@ def contourf(self, X, Y, Z, *args, zdir='z', offset=None, **kwargs):
22082172
Parameters
22092173
----------
22102174
X, Y, Z : array-like
2211-
Input data. See `~matplotlib.axes.Axes.contourf` for acceptable
2212-
data shapes.
2175+
Input data. See `.Axes.contourf` for supported data shapes.
22132176
zdir : {'x', 'y', 'z'}, default: 'z'
22142177
The direction to use.
22152178
offset : float, optional
@@ -2247,8 +2210,7 @@ def tricontourf(self, *args, zdir='z', offset=None, **kwargs):
22472210
Parameters
22482211
----------
22492212
X, Y, Z : array-like
2250-
Input data. See `~matplotlib.axes.Axes.tricontourf` for acceptable
2251-
data shapes.
2213+
Input data. See `.Axes.tricontourf` for supported data shapes.
22522214
zdir : {'x', 'y', 'z'}, default: 'z'
22532215
The direction to use.
22542216
offset : float, optional
@@ -3056,7 +3018,7 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
30563018
this. *lims*-arguments may be scalars, or array-likes of the same
30573019
length as the errors. To use limits with inverted axes,
30583020
`~.Axes.set_xlim` or `~.Axes.set_ylim` must be called before
3059-
:meth:`errorbar`. Note the tricky parameter names: setting e.g.
3021+
`errorbar`. Note the tricky parameter names: setting e.g.
30603022
*ylolims* to True means that the y-value is a *lower* limit of the
30613023
True value, so, only an *upward*-pointing arrow will be drawn!
30623024

0 commit comments

Comments
 (0)