@@ -1559,14 +1559,23 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
1559
1559
The `rstride` and `cstride` kwargs set the stride used to
1560
1560
sample the input data to generate the graph. If 1k by 1k
1561
1561
arrays are passed in the default values for the strides will
1562
- result in a 100x100 grid being plotted.
1562
+ result in a 100x100 grid being plotted. Defaults to 10.
1563
+ Superceded by `rcount` and `ccount` if both the
1564
+ stride and the count are specified as of v2.0.0.
1565
+
1566
+ The `rcount` and `ccount` kwargs are the new method for
1567
+ sampling the input data to generate the graph, and
1568
+ supercedes `rstride` and `cstride` (unless using the
1569
+ 'classic' style) if both are specified. Added in v2.0.0.
1563
1570
1564
1571
============= ================================================
1565
1572
Argument Description
1566
1573
============= ================================================
1567
1574
*X*, *Y*, *Z* Data values as 2D arrays
1568
- *rstride* Array row stride (step size), defaults to 10
1569
- *cstride* Array column stride (step size), defaults to 10
1575
+ *rstride* Array row stride (step size)
1576
+ *cstride* Array column stride (step size)
1577
+ *rcount* Use at most this many rows, defaults to 50
1578
+ *ccount* Use at most this many columns, defaults to 50
1570
1579
*color* Color of the surface patches
1571
1580
*cmap* A colormap for the surface patches.
1572
1581
*facecolors* Face colors for the individual patches
@@ -1587,8 +1596,30 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
1587
1596
X , Y , Z = np .broadcast_arrays (X , Y , Z )
1588
1597
rows , cols = Z .shape
1589
1598
1599
+ has_rstride = 'rstride' in kwargs
1600
+ has_cstride = 'cstride' in kwargs
1601
+ has_rcount = 'rcount' in kwargs
1602
+ has_ccount = 'ccount' in kwargs
1603
+
1590
1604
rstride = kwargs .pop ('rstride' , 10 )
1591
1605
cstride = kwargs .pop ('cstride' , 10 )
1606
+ rcount = kwargs .pop ('rcount' , 50 )
1607
+ ccount = kwargs .pop ('ccount' , 50 )
1608
+
1609
+ if rcParams ['_internal.classic_mode' ]:
1610
+ # Strides have priority over counts in classic mode.
1611
+ if not has_rstride and has_rcount :
1612
+ rstride = int (np .ceil (rows / rcount ))
1613
+ if not has_cstride and has_ccount :
1614
+ cstride = int (np .ceil (cols / ccount ))
1615
+ else :
1616
+ # If the count is provided then it has priority
1617
+ # If neither count or stride is provided then use
1618
+ # the default count.
1619
+ if has_rcount or (not has_rstride and not has_rcount ):
1620
+ rstride = int (np .ceil (rows / rcount ))
1621
+ if has_ccount or (not has_cstride and not has_ccount ):
1622
+ cstride = int (np .ceil (cols / ccount ))
1592
1623
1593
1624
if 'facecolors' in kwargs :
1594
1625
fcolors = kwargs .pop ('facecolors' )
0 commit comments