Python Forum
multihistogram - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: multihistogram (/thread-24857.html)



multihistogram - aster - Mar-07-2020

Hello,

I am trying to make an histogram with 2 values (a,b) for each group

import matplotlib.pyplot as plt
a = [1,4]
b = [2,10]

plt.hist(x=[a, b], label=['a', 'b', 'c'], histtype='bar')
plt.legend(loc='upper left')
plt.show()
this is the output:
[attachment=793]

It is not what i need.
I want an histogram that for each series of values takes the firsts (i.e 1 and 2) and make two bars: bar 'a' tall 1 and bar 'b' tall 2. Then it goes to the next sequence and make another two bars: bar 'a' tall 4 and bar 'b' tall 10

How can i achieve it?

edit: i was completely wrong, i had to use bar not hist!