Should the number of displayed labels be clamped to the number of computed features? It's a bit weird to see data points labeled outside of the simplified line.
It's just one of many possibilities. Another difference is that for the labels I force the sorting by "error" rather than "by persistence", because it looks better for this chart.
Cool graphs :) To do TDA in 2 dimensions or more you can use the union-find data structure to merge features efficiently (https://observablehq.com/@fil/union-find?collection=@fil/tda); in 1 dimension like here, the algorithm is much simpler: look to the left for all the points of the old feature, and absorb them; then do the same to the right.