Path simplification in backend_ps

Are there any plans for path simplification in any of the non-agg backends? When plotting large numbers of data points (~50k upwards in my case) using the ps backend the resulting file are rather large (several MB). More of a concern is that they take a very long time (~5 minutes) to render with ghostscript on a modern computer with obvious negative implications if sending to a postscript printer / including in publication graphics.

I've added some _very_ simple path simplification to backend_ps.py, which is sufficient for my usage (see attached diff - against 0.98pre, rev 5075). Its pretty ugly though with an arbitrary delta value for determining whether it is safe to skip a point, and a boolean switch to turn it on & off, both currently as module-level variables.

If there is enough interest, and I was pointed in the direction of the necessary info I could try and clean it up a bit for potential inclusion.

I'd need to know the following:
Is the backend itself the best/preferred place to be doing path simplification?
What would be the best method of doing the configuration (turning on/off, setting delta)?
It would obviously be desirable to automagically select a reasonable delta value - although this is potentially difficult as the resulting graph can be arbitrarily scaled - any ideas?

best wishes,
David

      Win a MacBook Air or iPod touch with Yahoo!7. http://au.docs.yahoo.com/homepageset

backend_ps.py.diff (590 Bytes)

David Baddeley wrote:

Are there any plans for path simplification in any of the non-agg backends? When plotting large numbers of data points (~50k upwards in my case) using the ps backend the resulting file are rather large (several MB). More of a concern is that they take a very long time (~5 minutes) to render with ghostscript on a modern computer with obvious negative implications if sending to a postscript printer / including in publication graphics.

David,

Going back through my mail, I found your message. I don't know if anyone replied. In case no one did: yes, I think that having some path simplification for non-agg backends is a good idea, although slightly dangerous, and I hope it is not dropped. I don't really have time to think about your questions now; if you don't get, or haven't gotten, a reply from anyone, please submit your patch in a ticket:
http://sourceforge.net/tracker/?atid=560722&group_id=80706&func=browse

This should help keep it from getting forgotten.

Only quick comments below:

I've added some _very_ simple path simplification to backend_ps.py, which is sufficient for my usage (see attached diff - against 0.98pre, rev 5075). Its pretty ugly though with an arbitrary delta value for determining whether it is safe to skip a point, and a boolean switch to turn it on & off, both currently as module-level variables.

If there is enough interest, and I was pointed in the direction of the necessary info I could try and clean it up a bit for potential inclusion.

I'd need to know the following:
Is the backend itself the best/preferred place to be doing path simplification?

Surely it should be factored out so that the same code can be applied to ps, pdf, and svg. Either the path module or the backend_bases module seems the likely home for the code.

What would be the best method of doing the configuration (turning on/off, setting delta)?
It would obviously be desirable to automagically select a reasonable delta value - although this is potentially difficult as the resulting graph can be arbitrarily scaled - any ideas?

Agreed. The last time I looked, matlab essentially assumed there is a limit to the "arbitrary scaling", and used integers for postscript coordinates.

One might have an rc setting: off, auto, or a fixed value in physical page coordinates.

Eric

···

best wishes,
David