>>>>> "Scott" == Scott Ransom <[EMAIL PROTECTED]> writes:

    Scott> Hi All, I think I might have uncovered a bug in the legend
    Scott> code when using multiple patches so that only the first
    Scott> patch type is used in the legend.

    Scott> In [41]: matplotlib.__version__ Out[41]: '0.87.5'

    Scott> (that is revision 2782 from SVN)

    Scott> Here is some code that shows the problem:

    Scott> ------------------------------ from pylab import *

    Scott> binctrs = linspace(-4.0, 4.0, 15) vals = randn(1000) n1,
    Scott> bins1, p1 = hist(vals, binctrs, align='center') n2, bins2,
    Scott> p2 = hist(vals[:300], binctrs, align='center') setp(p1,
    Scott> 'facecolor', 'k', 'alpha', 0.2) setp(p2, 'facecolor', 'g',
    Scott> 'alpha', 0.9) legend((p1, p2), ("Frobs", "NewFrobs"))
    Scott> show() ------------------------------

The returned patches is a list of patches -- you just need to pick off
a representative one

ax = subplot(111)
binctrs = linspace(-4.0, 4.0, 15)
vals = randn(1000)
n1, bins1, p1 = hist(vals, binctrs, align='center', facecolor='black', 
alpha=0.2)
n2, bins2, p2 = hist(vals[:300], binctrs, align='center', facecolor='green', 
alpha=0.9)
legend((p1[0], p2[0]), ("Frobs", "NewFrobs"))
show()

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to