Skip to content

Commit 751e13d

Browse files
committed
Remove redundant int after round
1 parent 54360f3 commit 751e13d

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

examples/statistics/time_series_histogram.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# Generate unbiased Gaussian random walks
4242
Y = np.cumsum(np.random.randn(num_series, num_points), axis=-1)
4343
# Generate sinusoidal signals
44-
num_signal = int(round(SNR * num_series))
44+
num_signal = round(SNR * num_series)
4545
phi = (np.pi / 8) * np.random.randn(num_signal, 1) # small random offset
4646
Y[-num_signal:] = (
4747
np.sqrt(np.arange(num_points))[None, :] # random walk RMS scaling factor

lib/matplotlib/colors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def to_hex(c, keep_alpha=False):
515515
c = to_rgba(c)
516516
if not keep_alpha:
517517
c = c[:3]
518-
return "#" + "".join(format(int(round(val * 255)), "02x") for val in c)
518+
return "#" + "".join(format(round(val * 255), "02x") for val in c)
519519

520520

521521
### Backwards-compatible color-conversion API

lib/matplotlib/image.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1244,8 +1244,8 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
12441244
l, b, r, t = self.axes.bbox.extents
12451245
width = (round(r) + 0.5) - (round(l) - 0.5)
12461246
height = (round(t) + 0.5) - (round(b) - 0.5)
1247-
width = int(round(width * magnification))
1248-
height = int(round(height * magnification))
1247+
width = round(width * magnification)
1248+
height = round(height * magnification)
12491249
vl = self.axes.viewLim
12501250

12511251
x_pix = np.linspace(vl.x0, vl.x1, width)

lib/matplotlib/patches.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2568,9 +2568,9 @@ def _get_sawtooth_vertices(self, x0, y0, width, height, mutation_size):
25682568

25692569
# the sizes of the vertical and horizontal sawtooth are
25702570
# separately adjusted to fit the given box size.
2571-
dsx_n = int(round((width - tooth_size) / (tooth_size * 2))) * 2
2571+
dsx_n = round((width - tooth_size) / (tooth_size * 2)) * 2
25722572
dsx = (width - tooth_size) / dsx_n
2573-
dsy_n = int(round((height - tooth_size) / (tooth_size * 2))) * 2
2573+
dsy_n = round((height - tooth_size) / (tooth_size * 2)) * 2
25742574
dsy = (height - tooth_size) / dsy_n
25752575

25762576
x0, y0 = x0 - pad + tooth_size2, y0 - pad + tooth_size2

lib/mpl_toolkits/mplot3d/axes3d.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2021,9 +2021,9 @@ def _3d_extend_contour(self, cset, stride=5):
20212021
continue
20222022

20232023
stepsize = (len(topverts[0]) - 1) / (nsteps - 1)
2024-
for i in range(int(round(nsteps)) - 1):
2025-
i1 = int(round(i * stepsize))
2026-
i2 = int(round((i + 1) * stepsize))
2024+
for i in range(round(nsteps) - 1):
2025+
i1 = round(i * stepsize)
2026+
i2 = round((i + 1) * stepsize)
20272027
polyverts.append([topverts[0][i1],
20282028
topverts[0][i2],
20292029
botverts[0][i2],

0 commit comments

Comments
 (0)