Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multihistogram
#1
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:
   

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!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020