Reputation: 659
I have four pivot tables and I would like to do a chart to show them.
So far, I could get the plot doing the following but the only thing that I don't know how can achieve is to set the maximum value of the ylim pair custom for each table. Any ideas?
fig, axs = plt.subplots(2,2)
tablepart1.plot(title='part1', kind='bar',figsize=(20,10), ylim=(0.9,.93), ax=axs[0][0])
tablepart2.plot(title='part2', kind='bar',figsize=(20,10), ylim=(0.9,.93), ax=axs[0][1])
tablepart3.plot(title='part3', kind='bar',figsize=(20,10), ylim=(0.9,.93), ax=axs[1][0])
tablepart4.plot(title='part4', kind='bar',figsize=(20,10), ylim=(0.9,.93), ax=axs[1][1])
Each pivot table looks like this:
METHOD methA methB
PART P J
4 50 3 0.910996 0.909996
5 0.913883 0.912048
7 0.911054 0.912132
So, in this case, I would like to have ylim=(0.9,.913883) instead of ylim=(0.9,.93)
Upvotes: 2
Views: 149
Reputation: 659
I got the desired result doing:
(0.9, tablepart4.loc[:, ['methA', 'methB']].max().max()) )
Upvotes: 1