File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -159,8 +159,23 @@ def _slice_or_none(in_v, slc):
159
159
"markevery is specified relative to the axes size, but "
160
160
"the line does not have a Axes as parent" )
161
161
# calc cumulative distance along path (in display coords):
162
- aux = np .where (np .isfinite (tpath .vertices ), tpath .vertices ,
163
- np .nanmean (tpath .vertices , axis = 0 ))
162
+ mask = np .isnan (tpath .vertices )
163
+ if mask .any ():
164
+ aux = np .empty_like (tpath .vertices )
165
+ for ic , vals in enumerate (tpath .vertices .T ):
166
+ ok = ~ mask [:, ic ]
167
+ ii = np .where (ok , np .arange (ok .shape [0 ]), - 1 )
168
+ i0 , i1 = np .nonzero (ok )[0 ][[0 , - 1 ]]
169
+ ii [:i0 ] = i0
170
+ ilo = np .maximum .accumulate (ii )
171
+ ii [mask [:, ic ]] = ok .shape [0 ] - 1
172
+ ii [i1 :] = i1
173
+ ihi = np .minimum .accumulate (ii [::- 1 ])[::- 1 ]
174
+ aux [:, ic ] = 0.5 * (vals [ilo ] + vals [ihi ])
175
+
176
+ else :
177
+ aux = tpath .vertices
178
+
164
179
disp_coords = affine .transform (aux )
165
180
delta = np .empty ((len (disp_coords ), 2 ))
166
181
delta [0 , :] = 0
You can’t perform that action at this time.
0 commit comments