John,

Have you considered Allan's version of _backend_agg.cpp (message date 
was 06/27)?  I just tried it, and so far, I like it.  I have not found 
any problems with the backend_driver.py test, and the improvement in 
speed that Allan notes with the "plot(rand(100000))" example is 
dramatic--the difference between unusable for panning and zooming with 
the original backend, and quite responsive and very usable with Allan's 
version.

I have not tried to understand the algorithm or code.

Allan,

Can you suggest a simple test that graphically illustrates the "loss of 
accuracy", perhaps a worst case, so we can see whether this is an actual 
problem?

I am also wondering whether your optimization technique, or some 
variation of it, could and should be applied in the generation of 
vector-based printer files: ps, pdf, svg.  They can get excessively 
large and slow with very large datasets, and the ability to trim them 
with minimal loss of genuine information conveyed to the ultimate viewer 
of the plot would be very nice.

Eric

[EMAIL PROTECTED] wrote:
> Hi,
> 
> I've been plotting data with millions of datapoints, and it takes a long
> time for the plot to draw and to rescale with the mouse. I was playing
> around with the draw_lines function in the agg backend and sped it up a
> bit, maybe others will find it useful. I've attached my optimized version
> of _backend_agg.cpp. (just replace the old src/_backend_agg.cpp and
> recompile).
> 
> The main optimization is to combine sequential lines that are parallel
> into a single line to be drawn once. Try "plot(rand(100000),'-')" to see
> the change. Resizing and zooming should be faster than before.
> 
> This comes at the expense of accuracy since many lines are not drawn. I've
> tried to balance out accuracy vs speed to my liking. The main thing to
> tweak is a length threshold which I have hardcoded to 0.25. This is the
> squared length in pixels that we can move in the direction perpendicular
> to the set of parallel lines we are combining and still combine the lines.
> (so it can move 0.5 pixels to the side before a new line will be started).
> If you set it to 0, you should get the same plots as without my changes.
> 
> I also made it skip any lines that are outside of the drawing area.
> 
> Hopefully it's not buggy!
> 
> Allan

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to