If I set like
vec = 100*numpy.random.random((10,3))
it does not shpw lines even with changing the set_xlimit and set_ylimit. I
guess there is something related with scaling.
Jin
---
> Date: Wed, 13 Jul 2011 16:44:01 -0400
> Subject: Re: [Matplotlib-users] Question on LineCollection
> From: jne...@gmail.com
> To: sulsj0...@hotmail.com
> CC: matplotlib-users@lists.sourceforge.net
>
> 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