@@ -1555,13 +1555,17 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
1555
1555
sample the input data to generate the graph. If 1k by 1k
1556
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
- Superceded by `rcount` and `ccount` if both the
1559
- stride and the count are specified as of v2.0.0.
1560
-
1561
- The `rcount` and `ccount` kwargs are the new method for
1562
- sampling the input data to generate the graph, and
1563
- supercedes `rstride` and `cstride` (unless using the
1564
- 'classic' style) if both are specified. Added in v2.0.0.
1558
+ Raises a ValueError if both stride and count kwargs
1559
+ (see next section) are provided.
1560
+
1561
+ The `rcount` and `ccount` kwargs supersedes `rstride` and
1562
+ `cstride`for default sampling method for surface plotting.
1563
+ These arguments will determine at most how many evenly spaced
1564
+ samples will be taken from the input data to generate the graph.
1565
+ This is the default sampling method unless using the 'classic'
1566
+ style. Will raise ValueError if both stride and count are
1567
+ specified.
1568
+ Added in v2.0.0.
1565
1569
1566
1570
============= ================================================
1567
1571
Argument Description
@@ -1591,10 +1595,11 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
1591
1595
X , Y , Z = np .broadcast_arrays (X , Y , Z )
1592
1596
rows , cols = Z .shape
1593
1597
1594
- has_rstride = 'rstride' in kwargs
1595
- has_cstride = 'cstride' in kwargs
1596
- has_rcount = 'rcount' in kwargs
1597
- has_ccount = 'ccount' in kwargs
1598
+ has_stride = 'rstride' in kwargs or 'cstride' in kwargs
1599
+ has_count = 'rcount' in kwargs or 'rcount' in kwargs
1600
+
1601
+ if has_stride and has_count :
1602
+ raise ValueError ("Cannot specify both stride and count arguments" )
1598
1603
1599
1604
rstride = kwargs .pop ('rstride' , 10 )
1600
1605
cstride = kwargs .pop ('cstride' , 10 )
@@ -1603,17 +1608,16 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
1603
1608
1604
1609
if rcParams ['_internal.classic_mode' ]:
1605
1610
# Strides have priority over counts in classic mode.
1606
- if not has_rstride and has_rcount :
1611
+ # So, only compute strides from counts
1612
+ # if counts were explicitly given
1613
+ if has_count :
1607
1614
rstride = int (np .ceil (rows / rcount ))
1608
- if not has_cstride and has_ccount :
1609
1615
cstride = int (np .ceil (cols / ccount ))
1610
1616
else :
1611
- # If the count is provided then it has priority
1612
- # If neither count or stride is provided then use
1613
- # the default count.
1614
- if has_rcount or (not has_rstride and not has_rcount ):
1617
+ # If the strides are provided then it has priority.
1618
+ # Otherwise, compute the strides from the counts.
1619
+ if not has_stride :
1615
1620
rstride = int (np .ceil (rows / rcount ))
1616
- if has_ccount or (not has_cstride and not has_ccount ):
1617
1621
cstride = int (np .ceil (cols / ccount ))
1618
1622
1619
1623
if 'facecolors' in kwargs :
0 commit comments