8000 FIX: allow float markevery with nans in line data in _mark_every_path() · matplotlib/matplotlib@99d9475 · GitHub
[go: up one dir, main page]

Skip to content

Commit 99d9475

Browse files
committed
FIX: allow float markevery with nans in line data in _mark_every_path()
- TST: new test_markevery_linear_scales_nans() test + baseline images
1 parent a2a1b0a commit 99d9475

File tree

5 files changed

+3613
-2
lines changed

5 files changed

+3613
-2
lines changed

lib/matplotlib/lines.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,12 @@ def _slice_or_none(in_v, slc):
157157
raise ValueError(
158158
"markevery is specified relative to the axes size, but "
159159
"the line does not have a Axes as parent")
160+
160161
# calc cumulative distance along path (in display coords):
161-
disp_coords = affine.transform(tpath.vertices)
162+
fin = np.isfinite(verts).all(axis=1)
163+
fverts = verts[fin]
164+
disp_coords = affine.transform(fverts)
165+
162166
delta = np.empty((len(disp_coords), 2))
163167
delta[0, :] = 0
164168
delta[1:, :] = disp_coords[1:, :] - disp_coords[:-1, :]
@@ -174,7 +178,7 @@ def _slice_or_none(in_v, slc):
174178
inds = inds.argmin(axis=1)
175179
inds = np.unique(inds)
176180
# return, we are done here
177-
return Path(verts[inds], _slice_or_none(codes, inds))
181+
return Path(fverts[inds], _slice_or_none(codes, inds))
178182
else:
179183
raise ValueError(
180184
f"markevery={markevery!r} is a tuple with len 2, but its "
Binary file not shown.
Loading

0 commit comments

Comments
 (0)
0