Skip to content

Commit d376dad

Browse files
committed
More review comments
1 parent 95fa27f commit d376dad

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

lib/matplotlib/hatch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def __init__(self, hatch, density):
170170
path = Path.unit_regular_star(5)
171171
self.shape_vertices = path.vertices
172172
self.shape_codes = np.full(len(self.shape_vertices), Path.LINETO,
173-
dtype=np.int32)
173+
dtype=Path.code_type)
174174
self.shape_codes[0] = Path.MOVETO
175175
Shapes.__init__(self, hatch, density)
176176

lib/matplotlib/legend_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def create_artists(self, legend, orig_handle,
231231
xdata, xdata_marker = self.get_xdata(legend, xdescent, ydescent,
232232
width, height, fontsize)
233233

234-
ydata = np.full(xdata.shape, ((height - ydescent) / 2), float)
234+
ydata = np.full_like(xdata, ((height - ydescent) / 2))
235235
legline = Line2D(xdata, ydata)
236236

237237
self.update_prop(legline, orig_handle, legend)

lib/matplotlib/path.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def interpolated(self, steps):
552552
vertices = simple_linear_interpolation(self.vertices, steps)
553553
codes = self.codes
554554
if codes is not None:
555-
new_codes = np.full(((len(codes) - 1) * steps + 1, ), Path.LINETO,
555+
new_codes = np.full((len(codes) - 1) * steps + 1, Path.LINETO,
556556
dtype=self.code_type)
557557
new_codes[0::steps] = codes
558558
else:
@@ -865,7 +865,7 @@ def arc(cls, theta1, theta2, n=None, is_wedge=False):
865865
if is_wedge:
866866
length = n * 3 + 4
867867
vertices = np.zeros((length, 2), float)
868-
codes = np.full((length, ), cls.CURVE4, dtype=cls.code_type)
868+
codes = np.full(length, cls.CURVE4, dtype=cls.code_type)
869869
vertices[1] = [xA[0], yA[0]]
870870
codes[0:2] = [cls.MOVETO, cls.LINETO]
871871
codes[-2:] = [cls.LINETO, cls.CLOSEPOLY]
@@ -874,7 +874,7 @@ def arc(cls, theta1, theta2, n=None, is_wedge=False):
874874
else:
875875
length = n * 3 + 1
876876
vertices = np.empty((length, 2), float)
877-
codes = np.full((length, ), cls.CURVE4, dtype=cls.code_type)
877+
codes = np.full(length, cls.CURVE4, dtype=cls.code_type)
878878
vertices[0] = [xA[0], yA[0]]
879879
codes[0] = cls.MOVETO
880880
vertex_offset = 1

lib/matplotlib/tri/trirefine.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,8 @@ def _refine_triangulation_once(triangulation, ancestors=None):
238238
# (can be -1 if border edge)
239239
# For slave and master we will identify the apex pointing to the edge
240240
# start
241-
edge_elems = np.ravel(np.vstack([np.arange(ntri, dtype=np.int32),
242-
np.arange(ntri, dtype=np.int32),
243-
np.arange(ntri, dtype=np.int32)]))
244-
edge_apexes = np.ravel(np.vstack([np.zeros(ntri, dtype=np.int32),
245-
np.ones(ntri, dtype=np.int32),
246-
np.full(ntri, 2, dtype=np.int32)]))
241+
edge_elems = np.tile(np.arange(3, dtype=np.int32), ntri)
242+
edge_apexes = np.repeat(np.arange(3, dtype=np.int32), ntri)
247243
edge_neighbors = neighbors[edge_elems, edge_apexes]
248244
mask_masters = (edge_elems > edge_neighbors)
249245

0 commit comments

Comments
 (0)