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

Skip to content

Commit ee768ff

Browse files
committed
Update doctrings of plot_surface & plot_wireframe.
Emphasize the downsampling. Clarify when the defaults for rstride and cstride apply.
1 parent 9986196 commit ee768ff

File tree

1 file changed

+80
-73
lines changed

1 file changed

+80
-73
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 80 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,49 +1560,58 @@ def plot(self, xs, ys, *args, **kwargs):
15601560
plot3D = plot
15611561

15621562
def plot_surface(self, X, Y, Z, *args, **kwargs):
1563-
'''
1563+
"""
15641564
Create a surface plot.
15651565
1566-
By default it will be colored in shades of a solid color,
1567-
but it also supports color mapping by supplying the *cmap*
1568-
argument.
1569-
1570-
The `rstride` and `cstride` kwargs set the stride used to
1571-
sample the input data to generate the graph. If 1k by 1k
1572-
arrays are passed in, the default values for the strides will
1573-
result in a 100x100 grid being plotted. Defaults to 10.
1574-
Raises a ValueError if both stride and count kwargs
1575-
(see next section) are provided.
1576-
1577-
The `rcount` and `ccount` kwargs supersedes `rstride` and
1578-
`cstride` for default sampling method for surface plotting.
1579-
These arguments will determine at most how many evenly spaced
1580-
samples will be taken from the input data to generate the graph.
1581-
This is the default sampling method unless using the 'classic'
1582-
style. Will raise ValueError if both stride and count are
1583-
specified.
1584-
Added in v2.0.0.
1566+
By default it will be colored in shades of a solid color, but it also
1567+
supports color mapping by supplying the *cmap* argument.
15851568
1586-
============= ================================================
1587-
Argument Description
1588-
============= ================================================
1589-
*X*, *Y*, *Z* Data values as 2D arrays
1590-
*rstride* Array row stride (step size)
1591-
*cstride* Array column stride (step size)
1592-
*rcount* Use at most this many rows, defaults to 50
1593-
*ccount* Use at most this many columns, defaults to 50
1594-
*color* Color of the surface patches
1595-
*cmap* A colormap for the surface patches.
1596-
*facecolors* Face colors for the individual patches
1597-
*norm* An instance of Normalize to map values to colors
1598-
*vmin* Minimum value to map
1599-
*vmax* Maximum value to map
1600-
*shade* Whether to shade the facecolors
1601-
============= ================================================
1569+
.. warning::
16021570
1603-
Other arguments are passed on to
1604-
:class:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`
1605-
'''
1571+
The *rcount* and *ccount* kwargs, which both default to 50,
1572+
determine the maximum number of samples used in each direction. If
1573+
the input data is larger, it will be downsampled to these numbers
1574+
of points.
1575+
1576+
Parameters
1577+
----------
1578+
X, Y, Z : 2d arrays
1579+
Data values.
1580+
1581+
rcount, ccount : int
1582+
Maximum number of samples used in each direction. If the input
1583+
data is larger, it will be downsampled to these numbers of points.
1584+
Defaults to 50.
1585+
1586+
rstride, cstride : int
1587+
Downsampling stride in each direction. These arguments are
1588+
mutually exclusive with *rcount* and *ccount*. If only one of
1589+
*rcount* or *ccount* is set, the other defaults to 10.
1590+
1591+
'classic' mode uses a default of ``rstride = cstride = 10`` instead
1592+
of the new default of ``rcount = ccount = 50``.
1593+
1594+
color : color-like
1595+
Color of the surface patches.
1596+
1597+
cmap : Colormap
1598+
Colormap of the surface patches.
1599+
1600+
facecolors : array-like of colors.
1601+
Colors of each individual patch.
1602+
1603+
norm : Normalize
1604+
Normalization for the colormap.
1605+
1606+
vmin, vmax : float
1607+
Bounds for the normalization.
1608+
1609+
shade : bool
1610+
Whether to shade the face colors.
1611+
1612+
**kwargs :
1613+
Other arguments are forwarded to `~.Poly3DCollection`.
1614+
"""
16061615

16071616
had_data = self.has_data()
16081617

@@ -1779,44 +1788,42 @@ def _shade_colors_lightsource(self, data, cmap, lightsource):
17791788
return lightsource.shade(data, cmap)
17801789

17811790
def plot_wireframe(self, X, Y, Z, *args, **kwargs):
1782-
'''
1791+
"""
17831792
Plot a 3D wireframe.
17841793
1785-
The `rstride` and `cstride` kwargs set the stride used to
1786-
sample the input data to generate the graph. If either is 0
1787-
the input data in not sampled along this direction producing a
1788-
3D line plot rather than a wireframe plot. The stride arguments
1789-
are only used by default if in the 'classic' mode. They are
1790-
now superseded by `rcount` and `ccount`. Will raise ValueError
1791-
if both stride and count are used.
1792-
1793-
` The `rcount` and `ccount` kwargs supersedes `rstride` and
1794-
`cstride` for default sampling method for wireframe plotting.
1795-
These arguments will determine at most how many evenly spaced
1796-
samples will be taken from the input data to generate the graph.
1797-
This is the default sampling method unless using the 'classic'
1798-
style. Will raise ValueError if both stride and count are
1799-
specified. If either is zero, then the input data is not sampled
1800-
along this direction, producing a 3D line plot rather than a
1801-
wireframe plot.
1802-
Added in v2.0.0.
1794+
.. warning::
18031795
1804-
========== ================================================
1805-
Argument Description
1806-
========== ================================================
1807-
*X*, *Y*, Data values as 2D arrays
1808-
*Z*
1809-
*rstride* Array row stride (step size), defaults to 1
1810-
*cstride* Array column stride (step size), defaults to 1
1811-
*rcount* Use at most this many rows, defaults to 50
1812-
*ccount* Use at most this many columns, defaults to 50
1813-
========== ================================================
1814-
1815-
Keyword arguments are passed on to
1816-
:class:`~matplotlib.collections.LineCollection`.
1796+
The *rcount* and *ccount* kwargs, which both default to 50,
1797+
determine the maximum number of samples used in each direction. If
1798+
the input data is larger, it will be downsampled to these numbers
1799+
of points.
18171800
1818-
Returns a :class:`~mpl_toolkits.mplot3d.art3d.Line3DCollection`
1819-
'''
1801+
Parameters
1802+
----------
1803+
X, Y, Z : 2d arrays
1804+
Data values.
1805+
1806+
rcount, ccount : int
1807+
Maximum number of samples used in each direction. If the input
1808+
data is larger, it will be downsampled to these numbers of points.
1809+
Setting a count to zero causes the data to be not sampled in the
1810+
corresponding direction, producing a 3D line plot rather than a
1811+
wireframe plot. Defaults to 50.
1812+
1813+
rstride, cstride : int
1814+
Downsampling stride in each direction. These arguments are
1815+
mutually exclusive with *rcount* and *ccount*. If only one of
1816+
*rcount* or *ccount* is set, the other defaults to 1. Setting a
1817+
stride to zero causes the data to be not sampled in the
1818+
corresponding direction, producing a 3D line plot rather than a
1819+
wireframe plot.
1820+
1821+
'classic' mode uses a default of ``rstride = cstride = 1`` instead
1822+
of the new default of ``rcount = ccount = 50``.
1823+
1824+
**kwargs :
1825+
Other arguments are forwarded to `~.Line3DCollection`.
1826+
"""
18201827

18211828
had_data = self.has_data()
18221829
if Z.ndim != 2:

0 commit comments

Comments
 (0)