Vertices parsed from the path
How many samples the series has
The data vertices, or null when the count matches neither shape —
a library that simplifies collinear vertices produces neither, and
interpolating along the surviving segments is the right recovery there.
Pick the data vertices out of a rendered step path.
A step chart is drawn with the corner vertices the steps introduce, so the rendered path carries more vertices than the series has points — matplotlib emits
2N - 1forhv/vhand2Nformid. The surplus is interleaved rather than trailing, so it is removed by stride:2N - 1vertices (hv/vh): the even-indexed vertices are exactly the data points; the odd-indexed ones are the corners.2Nvertices (mid): each data point owns a horizontal pair. The first and last runs are half-width —steps-midstarts atx[0]and ends atx[N-1]rather than at a midpoint — so those two samples sit at the outer end of their run and are read off directly. An interior run spans midpoint to midpoint, and its centre is the sample only when the spacing either side is equal: in general the centre is(x[i-1] + 2x[i] + x[i+1]) / 4, off by a quarter of the local second difference. The highlight therefore always lands inside the sample's own run — never on a neighbour's — but on an irregularly sampledmidchart it is not exactly on the sample. Recoveringx[i]exactly would mean iteratingx[i+1] = 2m[i] - x[i]from one end, which is numerically unstable over a long series; a bounded sub-run offset is the better trade.Shared with AreaTrace, which meets the same interleaved geometry once a band is stepped, so the two cannot disagree about which vertex is a sample.