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 91d115e

Browse filesBrowse files
authored
Merge pull request #29533 from anntzer/cleanup
Minor cleanups.
2 parents b62f009 + 9bf84be commit 91d115e
Copy full SHA for 91d115e

File tree

Expand file treeCollapse file tree

5 files changed

+27
-38
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+27
-38
lines changed

‎lib/matplotlib/dviread.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dviread.py
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,10 @@ def __getitem__(self, texname):
893893
return self._parsed[texname]
894894
except KeyError:
895895
raise LookupError(
896-
f"An associated PostScript font (required by Matplotlib) "
897-
f"could not be found for TeX font {texname.decode('ascii')!r} "
898-
f"in {self._filename!r}; this problem can often be solved by "
899-
f"installing a suitable PostScript font package in your TeX "
900-
f"package manager") from None
896+
f"The font map {self._filename!r} is missing a PostScript font "
897+
f"associated to TeX font {texname.decode('ascii')!r}; this problem can "
898+
f"often be solved by installing a suitable PostScript font package in "
899+
f"your TeX package manager") from None
901900

902901
def _parse_and_cache_line(self, line):
903902
"""

‎lib/mpl_toolkits/axes_grid1/axes_grid.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axes_grid1/axes_grid.py
+17-21Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -251,28 +251,24 @@ def set_label_mode(self, mode):
251251
- "keep": Do not do anything.
252252
"""
253253
_api.check_in_list(["all", "L", "1", "keep"], mode=mode)
254-
is_last_row, is_first_col = (
255-
np.mgrid[:self._nrows, :self._ncols] == [[[self._nrows - 1]], [[0]]])
256-
if mode == "all":
257-
bottom = left = np.full((self._nrows, self._ncols), True)
258-
elif mode == "L":
259-
bottom = is_last_row
260-
left = is_first_col
261-
elif mode == "1":
262-
bottom = left = is_last_row & is_first_col
263-
else:
254+
if mode == "keep":
264255
return
265-
for i in range(self._nrows):
266-
for j in range(self._ncols):
267-
ax = self.axes_row[i][j]
268-
if isinstance(ax.axis, MethodType):
269-
bottom_axis = SimpleAxisArtist(ax.xaxis, 1, ax.spines["bottom"])
270-
left_axis = SimpleAxisArtist(ax.yaxis, 1, ax.spines["left"])
271-
else:
272-
bottom_axis = ax.axis["bottom"]
273-
left_axis = ax.axis["left"]
274-
bottom_axis.toggle(ticklabels=bottom[i, j], label=bottom[i, j])
275-
left_axis.toggle(ticklabels=left[i, j], label=left[i, j])
256+
for i, j in np.ndindex(self._nrows, self._ncols):
257+
ax = self.axes_row[i][j]
258+
if isinstance(ax.axis, MethodType):
259+
bottom_axis = SimpleAxisArtist(ax.xaxis, 1, ax.spines["bottom"])
260+
left_axis = SimpleAxisArtist(ax.yaxis, 1, ax.spines["left"])
261+
else:
262+
bottom_axis = ax.axis["bottom"]
263+
left_axis = ax.axis["left"]
264+
display_at_bottom = (i == self._nrows - 1 if mode == "L" else
265+
i == self._nrows - 1 and j == 0 if mode == "1" else
266+
True) # if mode == "all"
267+
display_at_left = (j == 0 if mode == "L" else
268+
i == self._nrows - 1 and j == 0 if mode == "1" else
269+
True) # if mode == "all"
270+
bottom_axis.toggle(ticklabels=display_at_bottom, label=display_at_bottom)
271+
left_axis.toggle(ticklabels=display_at_left, label=display_at_left)
276272

277273
def get_divider(self):
278274
return self._divider

‎lib/mpl_toolkits/axisartist/grid_finder.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axisartist/grid_finder.py
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,10 @@ def _find_line_box_crossings(xys, bbox):
3636
for u0, inside in [(umin, us > umin), (umax, us < umax)]:
3737
cross = []
3838
idxs, = (inside[:-1] ^ inside[1:]).nonzero()
39-
for idx in idxs:
40-
v = vs[idx] + (u0 - us[idx]) * dvs[idx] / dus[idx]
41-
if not vmin <= v <= vmax:
42-
continue
43-
crossing = (u0, v)[sl]
44-
theta = np.degrees(np.arctan2(*dxys[idx][::-1]))
45-
cross.append((crossing, theta))
46-
crossings.append(cross)
39+
vv = vs[idxs] + (u0 - us[idxs]) * dvs[idxs] / dus[idxs]
40+
crossings.append([
41+
((u0, v)[sl], np.degrees(np.arctan2(*dxy[::-1]))) # ((x, y), theta)
42+
for v, dxy in zip(vv, dxys[idxs]) if vmin <= v <= vmax])
4743
return crossings
4844

4945

‎lib/mpl_toolkits/mplot3d/art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/art3d.py
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,9 +1100,7 @@ def _get_vector(self, segments3d):
11001100
be of shape (num_faces, num_vertices, 3).
11011101
"""
11021102
if isinstance(segments3d, np.ndarray):
1103-
if segments3d.ndim != 3 or segments3d.shape[-1] != 3:
1104-
raise ValueError("segments3d must be a MxNx3 array, but got "
1105-
f"shape {segments3d.shape}")
1103+
_api.check_shape((None, None, 3), segments3d=segments3d)
11061104
if isinstance(segments3d, np.ma.MaskedArray):
11071105
self._faces = segments3d.data
11081106
self._invalid_vertices = segments3d.mask.any(axis=-1)

‎lib/mpl_toolkits/mplot3d/tests/test_axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/tests/test_axes3d.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ def test_poly3dcollection_verts_validation():
996996
art3d.Poly3DCollection(poly) # should be Poly3DCollection([poly])
997997

998998
poly = np.array(poly, dtype=float)
999-
with pytest.raises(ValueError, match=r'MxNx3 array'):
999+
with pytest.raises(ValueError, match=r'shape \(M, N, 3\)'):
10001000
art3d.Poly3DCollection(poly) # should be Poly3DCollection([poly])
10011001

10021002

0 commit comments

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