Hi John, On 5/31/07, John Hunter wrote: > On 5/31/07, Andrea Gavana <[EMAIL PROTECTED]> wrote: > > Hi All, > > > > I am writing an application (wxPython based) which embeds a big > > matplotlib figure as a main panel. Basically, this app shows oil well > > producers and gas injectors on a 2D map as dots (every dot represents > > its surface location), and a bunch of "streamlines" (i.e., straight > > lines or simple curves) which connect injectors and producers. > > As the numerical simulation continues, more and more streamlines are > > added to the plot (because of new wells or because interference > > between wells), and actually I end up having 200 dots plus 800-1200 > > lines. As the simulation progresses, the plots become slower and > > slower... > > As the lines are usually 2-points straight lines, I was thinking about > > using Line Collections; however, every matplotlib line has a linewidth > > value that is dependent on the calculated "interference" effect > > between wells, which means I have to build a matplotlib line for every > > line connecting an injector with a producer. Moreover, every injector > > well has its own colour for the streamlines (there are 33 injector > > wells). > > Will Line Collections save some time in this case? If not, does anyone > > have a suggestion on how I could try to speed-up the plotting? I am > > not really familiar with some obscure line/axes properties, so I may > > have overlooked something. > > Yes, a line collection will save you a lot of time with upwards of > 1000 line segments. This is the use case they were designed to solve: > a bunch of segments of differing widths and colors. One could > optimize it for the special case of simple line segments, ie [(x1,y1), > (x2, y2)] in which case we could use numpy arrays, but currently we > have only the general case of a collection of arbitrary length > segments, and since they are not necessarily the same length, we use a > sequence of segments rather than an array, and this is slower than it > could be.
Thank you for your answer. I am going to try to build these line collections and see what I can get. I never used them before so it's like I will get something not very well performing at first... Thank you for your answer, I am going to look at some examples... Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.virgilio.it/infinity77/ ------------------------------------------------------------------------- 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-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users