Hi, 

I'm plotting thousands of short lines on a plot. Because "plot" and "Line2D" 
are quite slow for this case, I'm trying to use lineCollection. Here comes the 
part of my testing code:

    ...
    segs = []

    # Manual set for testing
    x2 = np.zeros(2,dtype=int) 
    ys2 = [np.zeros(2,dtype=float)]
    x2[0] = 1000000
    x2[1] = 2000000    
    ys2[0][0] = ys2[0][1] = 50
    segs.extend( [zip(x2,y) for y in ys2] )
    
    for i in range(0, len(records)):
        ...
        # get xStart, xEnd, and y
        ...

        x2[0] = xStart
        x2[1] = xEnd
        ys2[0][0] = ys2[0][1] = y
        segs.extend( [zip(x2,y) for y in ys2] )

    line_segments = LineCollection(segs, linewidth=4, alpha=0.3, colors = 'r', 
linestyle = 'solid')
    ax.add_collection(line_segments)
    ...

The problem I have is only the first segment of the lines in the "segs" which I 
manually set the values is shown in the plot. If I move the first part in the 
for loop to test, it works. What am I missing? 

Thank you in advance.


Jin

---
                                          
------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to