On Wednesday, July 13, 2011, Justin McCann <jne...@gmail.com> wrote: > 2011/7/13 SULSEUNG-JIN <sulsj0...@hotmail.com>: >> Thanks, Justin >> >> I think I made a confusing example code. Here comes new one: > > Maybe you just need to force a call to draw() and set your x/y limits. > This works for me on matplotlib 1.0.1 > > $ ipython -pylab > # ==== > from matplotlib.collections import LineCollection > f = figure() > plot() > ax = gca() > vec = numpy.random.random((10,3)) > segs = [] > for i in range(0, len(vec)): > x1 = vec[i][0] > #x1 = 3000000 > x2 = vec[i][1] > #x2 = 4000000 > y1 = y2 = vec[i][2] > segs.extend( [[(x1,y1),(x2,y2)]] ) > > line_segments = LineCollection(segs, linewidth=3, alpha=0.3, colors = > 'r', linestyle = 'solid') > ax.add_collection(line_segments) > ax.set_xlim(0,1) > ax.set_ylim(0,1) > show() # hmmmm... nothing yet > draw() # force a draw; now it works > > ------------------------------------------------------------------------------ > 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 >
Just an observation (I haven't tested anything)... But what is up with the call to plot()? It might be causing issues with the autoscaler. Any line collections created without other plotting functions is going to need the axes limits set. Ben Root ------------------------------------------------------------------------------ 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