diff --git a/examples/statistics/time_series_histogram.py b/examples/statistics/time_series_histogram.py index 94f904fab91e..a22ceb4e24d4 100644 --- a/examples/statistics/time_series_histogram.py +++ b/examples/statistics/time_series_histogram.py @@ -41,7 +41,7 @@ # Generate unbiased Gaussian random walks Y = np.cumsum(np.random.randn(num_series, num_points), axis=-1) # Generate sinusoidal signals -num_signal = int(round(SNR * num_series)) +num_signal = round(SNR * num_series) phi = (np.pi / 8) * np.random.randn(num_signal, 1) # small random offset Y[-num_signal:] = ( np.sqrt(np.arange(num_points))[None, :] # random walk RMS scaling factor diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index f8a18443c9e0..73a5379f5d47 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -515,7 +515,7 @@ def to_hex(c, keep_alpha=False): c = to_rgba(c) if not keep_alpha: c = c[:3] - return "#" + "".join(format(int(round(val * 255)), "02x") for val in c) + return "#" + "".join(format(round(val * 255), "02x") for val in c) ### Backwards-compatible color-conversion API diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 6401b64dc248..342a8b663372 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -1244,8 +1244,8 @@ def make_image(self, renderer, magnification=1.0, unsampled=False): l, b, r, t = self.axes.bbox.extents width = (round(r) + 0.5) - (round(l) - 0.5) height = (round(t) + 0.5) - (round(b) - 0.5) - width = int(round(width * magnification)) - height = int(round(height * magnification)) + width = round(width * magnification) + height = round(height * magnification) vl = self.axes.viewLim x_pix = np.linspace(vl.x0, vl.x1, width) diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index f61524f65597..22b5e90946d8 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -2568,9 +2568,9 @@ def _get_sawtooth_vertices(self, x0, y0, width, height, mutation_size): # the sizes of the vertical and horizontal sawtooth are # separately adjusted to fit the given box size. - dsx_n = int(round((width - tooth_size) / (tooth_size * 2))) * 2 + dsx_n = round((width - tooth_size) / (tooth_size * 2)) * 2 dsx = (width - tooth_size) / dsx_n - dsy_n = int(round((height - tooth_size) / (tooth_size * 2))) * 2 + dsy_n = round((height - tooth_size) / (tooth_size * 2)) * 2 dsy = (height - tooth_size) / dsy_n x0, y0 = x0 - pad + tooth_size2, y0 - pad + tooth_size2 diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index 23b3571a4a38..e7bb091f4bb0 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -2021,9 +2021,9 @@ def _3d_extend_contour(self, cset, stride=5): continue stepsize = (len(topverts[0]) - 1) / (nsteps - 1) - for i in range(int(round(nsteps)) - 1): - i1 = int(round(i * stepsize)) - i2 = int(round((i + 1) * stepsize)) + for i in range(round(nsteps) - 1): + i1 = round(i * stepsize) + i2 = round((i + 1) * stepsize) polyverts.append([topverts[0][i1], topverts[0][i2], botverts[0][i2],