On Fri, Oct 28, 2011 at 00:56, Sterling Smith <[email protected]> wrote:
> Here is a working example:
>
> from pylab import figure, arange
> fig = figure(1)
> fig.clear()
> ax = fig.add_subplot(111)
> x = arange(0,1,.25)
> y1 = x
> y2 = x**2
> y3 = x**3
> l1 = ax.plot(x,y1,'bo-')
> l2 = ax.plot(x,y2,'go-')
> l3 = []
> for xi,x1 in enumerate(x):
> l3.append(ax.plot(x1,y3[xi],'ro-'))
> print l1,l2,l3
> leg = ax.legend((l1[0],l2[0],l3[0][0]),('$x$','$x^2$','$x^3$'),
> numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True)
OK, you're example works but trying to modify my code is resulting in
the same errors. But it's late so that's a job for tomorrow...
> Note that when l1 and l2 are printed that they are 1-element lists, and l3 is
> a list of 1-element lists, all of which are not the type of handles that
> legend is looking for. Furthermore, in your code, you are trying to embed
> these lists in yet another layer of list.
Thanks, this is starting to make sense...
> If your code worked as it was with previous versions of matplotlib, then
> maybe someone with more knowledge could explain what changed to not allow
> your code to work now (it may be related to
> https://github.com/matplotlib/matplotlib/pull/534).
It worked without issue with matplotlib-1.0.1.
Cheers
Adam
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users