why legend does not show in matplotlib-1.2.1 & py2.7

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

why legend does not show in matplotlib-1.2.1 & py2.7

oyster-2
the following code runs ok with py2.4 and matplotlib.0.98.3
however no legend appears with py2.7.3 and matplotlib-1.2.1/1.3. and I get
[quote]
e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U
serWarning: Legend does not support [<matplotlib.patches.Wedge object at 0x03842
0F0>, <matplotlib.patches.Wedge object at 0x03842530>, <matplotlib.patches.Wedge
 object at 0x03842930>, <matplotlib.patches.Wedge object at 0x03842D30>, <matplo
tlib.patches.Wedge object at 0x038B0150>]
Use proxy artist instead.

http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist

  (str(orig_handle),))
e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U
serWarning: Legend does not support [<matplotlib.text.Text object at 0x03842310>
, <matplotlib.text.Text object at 0x03842750>, <matplotlib.text.Text object at 0
x03842B50>, <matplotlib.text.Text object at 0x03842F50>, <matplotlib.text.Text o
bject at 0x038B0370>]
Use proxy artist instead.

http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist

  (str(orig_handle),))
[/quote]

what's the matter? thanks

[code]
#coding=utf-8
from pylab import *

val2010 = [2, 10, 20, 15, 3]

figure()

pie2010=pie(val2010, labels=[u'%i persons' % i for i in val2010])

plt.legend( (pie2010), [u'<60', u'60~70', u'70~80', u'80~90',
u'90~100'], loc = 'best', bbox_to_anchor = (0.90, 0.75) )
axis('equal')

show()
[/code]

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: why legend does not show in matplotlib-1.2.1 & py2.7

Paul Hobson-2
Sorry I have to be so brief, but just like the error says, you fed the legend function the wedges returned by the pie command. But legend can't handle wedges. As the proxy artist tutorial hints, you need to feed it rectangles created manually (i.e., outside of any plotting commands).

Hope that gets you started,
-paul


On Wed, May 22, 2013 at 8:06 AM, oyster <[hidden email]> wrote:
the following code runs ok with py2.4 and matplotlib.0.98.3
however no legend appears with py2.7.3 and matplotlib-1.2.1/1.3. and I get
[quote]
e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U
serWarning: Legend does not support [<matplotlib.patches.Wedge object at 0x03842
0F0>, <matplotlib.patches.Wedge object at 0x03842530>, <matplotlib.patches.Wedge
 object at 0x03842930>, <matplotlib.patches.Wedge object at 0x03842D30>, <matplo
tlib.patches.Wedge object at 0x038B0150>]
Use proxy artist instead.

http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist

  (str(orig_handle),))
e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U
serWarning: Legend does not support [<matplotlib.text.Text object at 0x03842310>
, <matplotlib.text.Text object at 0x03842750>, <matplotlib.text.Text object at 0
x03842B50>, <matplotlib.text.Text object at 0x03842F50>, <matplotlib.text.Text o
bject at 0x038B0370>]
Use proxy artist instead.

http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist

  (str(orig_handle),))
[/quote]

what's the matter? thanks

[code]
#coding=utf-8
from pylab import *

val2010 = [2, 10, 20, 15, 3]

figure()

pie2010=pie(val2010, labels=[u'%i persons' % i for i in val2010])

plt.legend( (pie2010), [u'<60', u'60~70', u'70~80', u'80~90',
u'90~100'], loc = 'best', bbox_to_anchor = (0.90, 0.75) )
axis('equal')

show()
[/code]

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: why legend does not show in matplotlib-1.2.1 & py2.7

Jae-Joon Lee
I do not have any access to mpl 0.98 so I cannot tell for sure. My guess is that you have been using a feature that has not been intended, that has fixed at some point. The first argument to legend should be a list of artists. And pie2010 is a tuple of a list of patches and a list of texts, i.e., they are not compatible with the current implementation of legend. Maybe the below is what you wanted?

plt.legend( (pie2010[0]), ...)

Regards,

-JJ



On Fri, May 24, 2013 at 6:19 AM, Paul Hobson <[hidden email]> wrote:
Sorry I have to be so brief, but just like the error says, you fed the legend function the wedges returned by the pie command. But legend can't handle wedges. As the proxy artist tutorial hints, you need to feed it rectangles created manually (i.e., outside of any plotting commands).

Hope that gets you started,
-paul


On Wed, May 22, 2013 at 8:06 AM, oyster <[hidden email]> wrote:
the following code runs ok with py2.4 and matplotlib.0.98.3
however no legend appears with py2.7.3 and matplotlib-1.2.1/1.3. and I get
[quote]
e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U
serWarning: Legend does not support [<matplotlib.patches.Wedge object at 0x03842
0F0>, <matplotlib.patches.Wedge object at 0x03842530>, <matplotlib.patches.Wedge
 object at 0x03842930>, <matplotlib.patches.Wedge object at 0x03842D30>, <matplo
tlib.patches.Wedge object at 0x038B0150>]
Use proxy artist instead.

http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist

  (str(orig_handle),))
e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U
serWarning: Legend does not support [<matplotlib.text.Text object at 0x03842310>
, <matplotlib.text.Text object at 0x03842750>, <matplotlib.text.Text object at 0
x03842B50>, <matplotlib.text.Text object at 0x03842F50>, <matplotlib.text.Text o
bject at 0x038B0370>]
Use proxy artist instead.

http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist

  (str(orig_handle),))
[/quote]

what's the matter? thanks

[code]
#coding=utf-8
from pylab import *

val2010 = [2, 10, 20, 15, 3]

figure()

pie2010=pie(val2010, labels=[u'%i persons' % i for i in val2010])

plt.legend( (pie2010), [u'<60', u'60~70', u'70~80', u'80~90',
u'90~100'], loc = 'best', bbox_to_anchor = (0.90, 0.75) )
axis('equal')

show()
[/code]

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users