Histogram with multiple data

Hi,

I'm trying to add label to a histogram with multiple data. The doc says "label can also be a sequence of strings" but when I try:

plt.hist([listA, listB, listC], bins=25, histtype='bar', alpha=0.75,rwidth=0.85,label=['A','B','C'])

I got an error:
"AttributeError: 'tuple' object has no attribute 'startswith'"
(for the entire traceback see http://paste.pocoo.org/show/119820/ )

is it me or a bug?

Can I add a legend in another way?

thanks in advance!

-Yva.

Hi,
I have the same problem. If you found the solution could you please post?

Thanks

uma

Yves-Alexandre wrote:

···

Hi,

I'm trying to add label to a histogram with multiple data. The doc says
"label can also be a sequence of strings" but when I try:

plt.hist([listA, listB, listC], bins=25, histtype='bar',
alpha=0.75,rwidth=0.85,label=['A','B','C'])

I got an error:
"AttributeError: 'tuple' object has no attribute 'startswith'"
(for the entire traceback see http://paste.pocoo.org/show/119820/ )

is it me or a bug?

Can I add a legend in another way?

thanks in advance!

-Yva.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals.
Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like
Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
View this message in context: http://www.nabble.com/Histogram-with-multiple-data-tp23787422p24197283.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

I guess you're providing an input data with a wrong shape.

aa = np.transpose([listA, listB, listC])
plt.hist(aa, bins=4, histtype='bar',
alpha=0.75,rwidth=0.85,label=['A','B','C'])

Regards,

-JJ

···

On Thu, Jun 25, 2009 at 1:37 AM, Uma S<uma.sunderam@...287...> wrote:

Hi,
I have the same problem. If you found the solution could you please post?

Thanks

uma

Yves-Alexandre wrote:

Hi,

I'm trying to add label to a histogram with multiple data. The doc says
"label can also be a sequence of strings" but when I try:

plt.hist([listA, listB, listC], bins=25, histtype='bar',
alpha=0.75,rwidth=0.85,label=['A','B','C'])

I got an error:
"AttributeError: 'tuple' object has no attribute 'startswith'"
(for the entire traceback see http://paste.pocoo.org/show/119820/ )

is it me or a bug?

Can I add a legend in another way?

thanks in advance!

-Yva.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals.
Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like
Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
View this message in context: http://www.nabble.com/Histogram-with-multiple-data-tp23787422p24197283.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options