Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1bffc4a

Browse filesBrowse files
committed
Trivial cleanups.
1 parent e285dde commit 1bffc4a
Copy full SHA for 1bffc4a

File tree

Expand file treeCollapse file tree

2 files changed

+7
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-8
lines changed

‎lib/matplotlib/hatch.py

Copy file name to clipboardExpand all lines: lib/matplotlib/hatch.py
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, hatch, density):
5757
self.num_vertices = 0
5858

5959
def set_vertices_and_codes(self, vertices, codes):
60-
steps = np.linspace(-0.5, 0.5, self.num_lines + 1, True)
60+
steps = np.linspace(-0.5, 0.5, self.num_lines + 1)
6161
vertices[0::2, 0] = 0.0 + steps
6262
vertices[0::2, 1] = 0.0 - steps
6363
vertices[1::2, 0] = 1.0 + steps
@@ -77,7 +77,7 @@ def __init__(self, hatch, density):
7777
self.num_vertices = 0
7878

7979
def set_vertices_and_codes(self, vertices, codes):
80-
steps = np.linspace(-0.5, 0.5, self.num_lines + 1, True)
80+
steps = np.linspace(-0.5, 0.5, self.num_lines + 1)
8181
vertices[0::2, 0] = 0.0 + steps
8282
vertices[0::2, 1] = 1.0 + steps
8383
vertices[1::2, 0] = 1.0 + steps
@@ -111,10 +111,9 @@ def set_vertices_and_codes(self, vertices, codes):
111111
cursor = 0
112112
for row in range(self.num_rows + 1):
113113
if row % 2 == 0:
114-
cols = np.linspace(0.0, 1.0, self.num_rows + 1, True)
114+
cols = np.linspace(0, 1, self.num_rows + 1)
115115
else:
116-
cols = np.linspace(offset / 2.0, 1.0 - offset / 2.0,
117-
self.num_rows, True)
116+
cols = np.linspace(offset / 2, 1 - offset / 2, self.num_rows)
118117
row_pos = row * offset
119118
for col_pos in cols:
120119
vertices[cursor:cursor + shape_size] = (shape_vertices +

‎lib/matplotlib/legend_handler.py

Copy file name to clipboardExpand all lines: lib/matplotlib/legend_handler.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def get_xdata(self, legend, xdescent, ydescent, width, height, fontsize):
168168
numpoints)
169169
xdata_marker = xdata
170170
else:
171-
xdata = np.linspace(-xdescent, -xdescent + width, 2)
171+
xdata = [-xdescent, -xdescent + width]
172172
xdata_marker = [-xdescent + 0.5 * width]
173173
return xdata, xdata_marker
174174

@@ -326,7 +326,7 @@ def create_artists(self, legend, orig_handle,
326326

327327
xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
328328
width, height, fontsize)
329-
ydata = ((height - ydescent) / 2.) * np.ones(xdata.shape, float)
329+
ydata = np.full_like(xdata, (height - ydescent) / 2)
330330
legline = Line2D(xdata, ydata)
331331

332332
self.update_prop(legline, orig_handle, legend)
@@ -468,7 +468,7 @@ def create_artists(self, legend, orig_handle,
468468
xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
469469
width, height, fontsize)
470470

471-
ydata = ((height - ydescent) / 2.) * np.ones(xdata.shape, float)
471+
ydata = np.full_like(xdata, (height - ydescent) / 2)
472472
legline = Line2D(xdata, ydata)
473473

474474
xdata_marker = np.asarray(xdata_marker)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.