Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: Remove redundant int after round #24302

Merged
merged 1 commit into from Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/statistics/time_series_histogram.py
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/colors.py
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/image.py
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/patches.py
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Expand Up @@ -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],
Expand Down