Reputation: 6517
Can you plot a histogram in matplotlib so that it appears upside down, i.e. the base of the histogram is along the top axis and it "hangs" down? Or, alternatively, if plotting with orientation='horizontal'
, so that the base of the histogram is on the right hand axis?
Upvotes: 6
Views: 2783
Reputation: 153550
Yes, use invert_yaxis
:
df = pd.DataFrame({'a':[1,2,3,1,2,2,2],
'b':[1,1,1,3,2,2,2]})
ax = df.plot.hist()
ax.invert_yaxis()
Output:
Upvotes: 5