diff --git a/examples/text_labels_and_annotations/arrow_demo.py b/examples/text_labels_and_annotations/arrow_demo.py index 943d11077bb3..0b8ccec4bcab 100644 --- a/examples/text_labels_and_annotations/arrow_demo.py +++ b/examples/text_labels_and_annotations/arrow_demo.py @@ -110,14 +110,10 @@ def do_fontsize(k): return float(np.clip(max_text_size * np.sqrt(data[k]), min_text_size, max_text_size)) - A = plt.text(0, 1, '$A_3$', color='r', size=do_fontsize('A'), - **text_params) - T = plt.text(1, 1, '$T_3$', color='k', size=do_fontsize('T'), - **text_params) - G = plt.text(0, 0, '$G_3$', color='g', size=do_fontsize('G'), - **text_params) - C = plt.text(1, 0, '$C_3$', color='b', size=do_fontsize('C'), - **text_params) + plt.text(0, 1, '$A_3$', color='r', size=do_fontsize('A'), **text_params) + plt.text(1, 1, '$T_3$', color='k', size=do_fontsize('T'), **text_params) + plt.text(0, 0, '$G_3$', color='g', size=do_fontsize('G'), **text_params) + plt.text(1, 0, '$C_3$', color='b', size=do_fontsize('C'), **text_params) arrow_h_offset = 0.25 # data coordinates, empirically determined max_arrow_length = 1 - 2 * arrow_h_offset diff --git a/lib/matplotlib/backends/backend_gtk3.py b/lib/matplotlib/backends/backend_gtk3.py index c06f4a6c6919..c5916e15046e 100644 --- a/lib/matplotlib/backends/backend_gtk3.py +++ b/lib/matplotlib/backends/backend_gtk3.py @@ -364,7 +364,7 @@ def __init__(self, canvas, num): self.toolbar = self._get_toolbar() self.statusbar = None - def add_widget(child, expand, fill, padding): + def add_widget(child): child.show() self.vbox.pack_end(child, False, False, 0) size_request = child.size_request() @@ -375,12 +375,12 @@ def add_widget(child, expand, fill, padding): if self.toolbar: backend_tools.add_tools_to_container(self.toolbar) self.statusbar = StatusbarGTK3(self.toolmanager) - h += add_widget(self.statusbar, False, False, 0) - h += add_widget(Gtk.HSeparator(), False, False, 0) + h += add_widget(self.statusbar) + h += add_widget(Gtk.HSeparator()) if self.toolbar is not None: self.toolbar.show() - h += add_widget(self.toolbar, False, False, 0) + h += add_widget(self.toolbar) self.window.set_default_size(w, h) diff --git a/lib/matplotlib/backends/backend_pdf.py b/lib/matplotlib/backends/backend_pdf.py index 0546fc3461b7..2d20145c38fb 100644 --- a/lib/matplotlib/backends/backend_pdf.py +++ b/lib/matplotlib/backends/backend_pdf.py @@ -1418,7 +1418,6 @@ def _unpack(self, im): ``(height, width, 3)`` (RGB) or ``(height, width, 1)`` (grayscale or alpha), except that alpha is None if the image is fully opaque. """ - h, w = im.shape[:2] im = im[::-1] if im.ndim == 2: return im, None diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index 8e108dd57f86..38fe1c189dbc 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -299,8 +299,6 @@ def draw_image(self, gc, x, y, im, transform=None): xscale = 1.0 yscale = 1.0 - figh = self.height * 72 - bbox = gc.get_clip_rectangle() clippath, clippath_trans = gc.get_clip_path() diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index 5aa4b2955a44..3c3250ce0fa0 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -1140,7 +1140,7 @@ def _autolev(self, N): return lev[i0:i1] - def _contour_level_args(self, z, args): + def _process_contour_level_args(self, args): """ Determine the contour levels and store in self.levels. """ @@ -1484,7 +1484,7 @@ def _contour_args(self, args, kwargs): cbook._warn_external('Log scale: values of z <= 0 have been ' 'masked') self.zmin = float(z.min()) - self._contour_level_args(z, args) + self._process_contour_level_args(args) return (x, y, z) def _check_xyz(self, args, kwargs): diff --git a/lib/matplotlib/tight_layout.py b/lib/matplotlib/tight_layout.py index f613450a93a7..fb156762be7b 100644 --- a/lib/matplotlib/tight_layout.py +++ b/lib/matplotlib/tight_layout.py @@ -90,8 +90,8 @@ def auto_adjust_subplotpars( else: margin_top = None - vspaces = [[] for i in range((rows + 1) * cols)] - hspaces = [[] for i in range(rows * (cols + 1))] + vspaces = [[] for _ in range((rows + 1) * cols)] + hspaces = [[] for _ in range(rows * (cols + 1))] union = Bbox.union diff --git a/lib/matplotlib/tri/tricontour.py b/lib/matplotlib/tri/tricontour.py index bb0ed8c59151..75d769ceec7d 100644 --- a/lib/matplotlib/tri/tricontour.py +++ b/lib/matplotlib/tri/tricontour.py @@ -99,7 +99,7 @@ def _contour_args(self, args, kwargs): self.zmin = float(z_check.min()) if self.logscale and self.zmin <= 0: raise ValueError('Cannot %s log of negative values.' % fn) - self._contour_level_args(z, args[1:]) + self._process_contour_level_args(args[1:]) return (tri, z) diff --git a/lib/matplotlib/type1font.py b/lib/matplotlib/type1font.py index cd38c95fe44c..343131eccdfd 100644 --- a/lib/matplotlib/type1font.py +++ b/lib/matplotlib/type1font.py @@ -291,7 +291,7 @@ def replacer(tokens): return replacer def suppress(tokens): - for x in itertools.takewhile(lambda x: x[1] != b'def', tokens): + for _ in itertools.takewhile(lambda x: x[1] != b'def', tokens): pass yield b'' diff --git a/lib/mpl_toolkits/axes_grid1/colorbar.py b/lib/mpl_toolkits/axes_grid1/colorbar.py index 7d0b485430e3..562f074fdd04 100644 --- a/lib/mpl_toolkits/axes_grid1/colorbar.py +++ b/lib/mpl_toolkits/axes_grid1/colorbar.py @@ -386,7 +386,7 @@ def __init__(self, ax, elif ticks is not None: self.cbar_axis.set_major_locator(ticks) else: - self._select_locator(formatter) + self._select_locator() self._config_axes() @@ -563,7 +563,7 @@ def add_lines(self, levels, colors, linewidths): col.set_color(colors) self.ax.add_collection(col) - def _select_locator(self, formatter): + def _select_locator(self): """Select a suitable locator.""" if self.boundaries is None: if isinstance(self.norm, colors.NoNorm):