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

Skip to content

Commit 3b4003f

Browse files
committed
MAINT: Reduce duplication of stride / count calculations
1 parent acd8ec0 commit 3b4003f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,15 +1653,15 @@ def plot_surface(self, X, Y, Z, *args, **kwargs):
16531653
# Strides have priority over counts in classic mode.
16541654
# So, only compute strides from counts
16551655
# if counts were explicitly given
1656-
if has_count:
1657-
rstride = int(max(np.ceil(rows / rcount), 1))
1658-
cstride = int(max(np.ceil(cols / ccount), 1))
1656+
compute_strides = has_count
16591657
else:
16601658
# If the strides are provided then it has priority.
16611659
# Otherwise, compute the strides from the counts.
1662-
if not has_stride:
1663-
rstride = int(max(np.ceil(rows / rcount), 1))
1664-
cstride = int(max(np.ceil(cols / ccount), 1))
1660+
compute_strides = not has_stride
1661+
1662+
if compute_strides:
1663+
rstride = int(max(np.ceil(rows / rcount), 1))
1664+
cstride = int(max(np.ceil(cols / ccount), 1))
16651665

16661666
if 'facecolors' in kwargs:
16671667
fcolors = kwargs.pop('facecolors')

0 commit comments

Comments
 (0)