@@ -1553,7 +1553,7 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
1553
1553
1554
1554
The `rstride` and `cstride` kwargs set the stride used to
1555
1555
sample the input data to generate the graph. If 1k by 1k
1556
- arrays are passed in the default values for the strides will
1556
+ arrays are passed in, the default values for the strides will
1557
1557
result in a 100x100 grid being plotted. Defaults to 10.
1558
1558
Raises a ValueError if both stride and count kwargs
1559
1559
(see next section) are provided.
@@ -1596,7 +1596,7 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
1596
1596
rows , cols = Z .shape
1597
1597
1598
1598
has_stride = 'rstride' in kwargs or 'cstride' in kwargs
1599
- has_count = 'rcount' in kwargs or 'rcount ' in kwargs
1599
+ has_count = 'rcount' in kwargs or 'ccount ' in kwargs
1600
1600
1601
1601
if has_stride and has_count :
1602
1602
raise ValueError ("Cannot specify both stride and count arguments" )
@@ -1768,7 +1768,21 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
1768
1768
The `rstride` and `cstride` kwargs set the stride used to
1769
1769
sample the input data to generate the graph. If either is 0
1770
1770
the input data in not sampled along this direction producing a
1771
- 3D line plot rather than a wireframe plot.
1771
+ 3D line plot rather than a wireframe plot. The stride arguments
1772
+ are only used by default if in the 'classic' mode. They are
1773
+ now superceeded by `rcount` and `ccount`. Will raise ValueError
1774
+ if both stride and count are used.
1775
+
1776
+ ` The `rcount` and `ccount` kwargs supersedes `rstride` and
1777
+ `cstride`for default sampling method for wireframe plotting.
1778
+ These arguments will determine at most how many evenly spaced
1779
+ samples will be taken from the input data to generate the graph.
1780
+ This is the default sampling method unless using the 'classic'
1781
+ style. Will raise ValueError if both stride and count are
1782
+ specified. If either is zero, then the input data is not sampled
1783
+ along this direction, producing a 3D line plot rather than a
1784
+ wireframe plot.
1785
+ Added in v2.0.0.
1772
1786
1773
1787
========== ================================================
1774
1788
Argument Description
@@ -1777,6 +1791,8 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
1777
1791
*Z*
1778
1792
*rstride* Array row stride (step size), defaults to 1
1779
1793
*cstride* Array column stride (step size), defaults to 1
1794
+ *rcount* Use at most this many rows, defaults to 50
1795
+ *ccount* Use at most this many columns, defaults to 50
1780
1796
========== ================================================
1781
1797
1782
1798
Keyword arguments are passed on to
@@ -1785,15 +1801,37 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs):
1785
1801
Returns a :class:`~mpl_toolkits.mplot3d.art3d.Line3DCollection`
1786
1802
'''
1787
1803
1788
- rstride = kwargs .pop ("rstride" , 1 )
1789
- cstride = kwargs .pop ("cstride" , 1 )
1790
-
1791
1804
had_data = self .has_data ()
1792
1805
Z = np .atleast_2d (Z )
1793
1806
# FIXME: Support masked arrays
1794
1807
X , Y , Z = np .broadcast_arrays (X , Y , Z )
1795
1808
rows , cols = Z .shape
1796
1809
1810
+ has_stride = 'rstride' in kwargs or 'cstride' in kwargs
1811
+ has_count = 'rcount' in kwargs or 'ccount' in kwargs
1812
+
1813
+ if has_stride and has_count :
1814
+ raise ValueError ("Cannot specify both stride and count arguments" )
1815
+
1816
+ rstride = kwargs .pop ('rstride' , 1 )
1817
+ cstride = kwargs .pop ('cstride' , 1 )
1818
+ rcount = kwargs .pop ('rcount' , 50 )
1819
+ ccount = kwargs .pop ('ccount' , 50 )
1820
+
1821
+ if rcParams ['_internal.classic_mode' ]:
1822
+ # Strides have priority over counts in classic mode.
1823
+ # So, only compute strides from counts
1824
+ # if counts were explicitly given
1825
+ if has_count :
1826
+ rstride = int (np .ceil (rows / rcount )) if rcount else 0
1827
+ cstride = int (np .ceil (cols / ccount )) if ccount else 0
1828
+ else :
1829
+ # If the strides are provided then it has priority.
1830
+ # Otherwise, compute the strides from the counts.
1831
+ if not has_stride :
1832
+ rstride = int (np .ceil (rows / rcount )) if rcount else 0
1833
+ cstride = int (np .ceil (cols / ccount )) if ccount else 0
1834
+
1797
1835
# We want two sets of lines, one running along the "rows" of
1798
1836
# Z and another set of lines running along the "columns" of Z.
1799
1837
# This transpose will make it easy to obtain the columns.
0 commit comments