diff --git a/lib/matplotlib/hatch.py b/lib/matplotlib/hatch.py index 01c030102981..d07d6b5ac01a 100644 --- a/lib/matplotlib/hatch.py +++ b/lib/matplotlib/hatch.py @@ -57,7 +57,7 @@ def __init__(self, hatch, density): self.num_vertices = 0 def set_vertices_and_codes(self, vertices, codes): - steps = np.linspace(-0.5, 0.5, self.num_lines + 1, True) + steps = np.linspace(-0.5, 0.5, self.num_lines + 1) vertices[0::2, 0] = 0.0 + steps vertices[0::2, 1] = 0.0 - steps vertices[1::2, 0] = 1.0 + steps @@ -77,7 +77,7 @@ def __init__(self, hatch, density): self.num_vertices = 0 def set_vertices_and_codes(self, vertices, codes): - steps = np.linspace(-0.5, 0.5, self.num_lines + 1, True) + steps = np.linspace(-0.5, 0.5, self.num_lines + 1) vertices[0::2, 0] = 0.0 + steps vertices[0::2, 1] = 1.0 + steps vertices[1::2, 0] = 1.0 + steps @@ -111,10 +111,9 @@ def set_vertices_and_codes(self, vertices, codes): cursor = 0 for row in range(self.num_rows + 1): if row % 2 == 0: - cols = np.linspace(0.0, 1.0, self.num_rows + 1, True) + cols = np.linspace(0, 1, self.num_rows + 1) else: - cols = np.linspace(offset / 2.0, 1.0 - offset / 2.0, - self.num_rows, True) + cols = np.linspace(offset / 2, 1 - offset / 2, self.num_rows) row_pos = row * offset for col_pos in cols: vertices[cursor:cursor + shape_size] = (shape_vertices + diff --git a/lib/matplotlib/legend_handler.py b/lib/matplotlib/legend_handler.py index 0d66105af55e..88e8e0fdf7ee 100644 --- a/lib/matplotlib/legend_handler.py +++ b/lib/matplotlib/legend_handler.py @@ -168,7 +168,7 @@ def get_xdata(self, legend, xdescent, ydescent, width, height, fontsize): numpoints) xdata_marker = xdata else: - xdata = np.linspace(-xdescent, -xdescent + width, 2) + xdata = [-xdescent, -xdescent + width] xdata_marker = [-xdescent + 0.5 * width] return xdata, xdata_marker @@ -326,7 +326,7 @@ def create_artists(self, legend, orig_handle, xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent, width, height, fontsize) - ydata = ((height - ydescent) / 2.) * np.ones(xdata.shape, float) + ydata = np.full_like(xdata, (height - ydescent) / 2) legline = Line2D(xdata, ydata) self.update_prop(legline, orig_handle, legend) @@ -468,7 +468,7 @@ def create_artists(self, legend, orig_handle, xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent, width, height, fontsize) - ydata = ((height - ydescent) / 2.) * np.ones(xdata.shape, float) + ydata = np.full_like(xdata, (height - ydescent) / 2) legline = Line2D(xdata, ydata) xdata_marker = np.asarray(xdata_marker)