[CB]: What is the maximum precision in Postscript? It seems unlikely that you
[CB]: could plot 80,000 points and not have number of them overlap, unless
[CB]: it's clipped, so removing essentially redundant points may be another
[CB]: way to to go.
This seems to be the way that xmgrace does it. I have been comparing
postscript output of mpl and xmgrace, and found that mpl incorporates the
fulll 80000 points while xmgrace only retains roughly 17000 of them.
So I downloaded the xmgrace source code and tried to figure out why this is
the case. Their postscript driver routines are in psdrv.c and are called by routines
in draw.c. Looking into the latter reveiled that they have indeed a purge_dense_points()
function, which removes the points that you wouldn't see on the plot anyway.
As far as I understand, the algorithm works as follows:
1) Define what you mean by "dense" points
a) init what you mean by far_away
b) start at the first point, and loop over the points until you find one far_away
c) hop to that one, continue looping until you find again a point far_away
d) hop to that one, continue looping... etc until you looped over all points
e) count the number of hops.
If all points turn out to be far away from each other, 'far_away'
was too conservative -> increase far_away and repeat steps b)-e).
In the other case: you found a definition of "dense"
2) Sift out the dense points
Similar to 1) but only keep the points you hopped to, i.e. the ones that
are far_away from each other.
It seems to work well for xmgrace, I never encountered any problems of too many
points purged. I do think it needs to be coded in C to work efficiently, though, i.e.
Python would be too slow. Perhaps the mpl developers might be interested to include
it one day? The gain in postscript file size would be huge...