8000 Merge pull request #22519 from rc/fix-float-markevery-with-nans · matplotlib/matplotlib@534fbb0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 534fbb0

Browse files
authored
Merge pull request #22519 from rc/fix-float-markevery-with-nans
fix markevery plot option with nans in data
2 parents 925b056 + 99d9475 commit 534fbb0

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