mattyd2
mattyd2

Reputation: 168

Matplotlib Bar Plot Grouping Subplots

I'm currently generating this plot:

enter image description here

But as you can see, it is taking taking the items from arrays below and spreading them across the xticks.

[array([ 1.77009257,  1.57980963,  0.31896943,  0.01874767]), array([ 1.02788175,  0.99604306])]

[array([ 0.20091287,  0.14682076,  0.03212798,  0.00187477]), array([ 0.09545977,  0.11318596])]

What I want is to create a cluster of all four items from the first array over the xtick -2wks and a cluster of the two items of the next array over xtick -1wk.

Bonus points if you can then give each bar in a given cluster the corresponding label from these arrays.

[Index([u'AL GAINESVILLE LOCK', u'AL GREENSBORO', u'AL HIGHLAND HOME', u'AL BREWTON 3 SSE'],dtype='object', name=u'StateCity'), Index([u'AL GREENSBORO', u'AL GAINESVILLE LOCK'], dtype='object', name=u'StateCity')]

Upvotes: 0

Views: 461

Answers (1)

Stefan
Stefan

Reputation: 42905

You might be best off using pandas plot for this. The second example here looks very similar to what you would like to achieve if I understand you correctly.

If you transpose your data so that the index you show below makes up the columns and your xticks make up the new index, you should get what you are looking for.

Upvotes: 1

Related Questions