Reputation: 3043
I'm plotting a graph with pandas like so
df9[(df9['Delivery Quality'] < 0) & (df9['year'] == 2016)][['country','Delivery Quality']].plot(x='country', y='Delivery Quality', kind='barh', figsize=(20,20), legend=False, secondary_y=False)
It returns this graph
This makes it a bit more harder to correlate the name with a column unlike positive values
The fix would be to either move the ylabels to the right or have the xvalues for the negative values move from right to left
Upvotes: 0
Views: 386
Reputation: 1129
With matplotlib axes' tick_right()
:
ax = frm.plot(x='country', y='Delivery Quality', kind='barh', figsize=(10,5), legend=False, secondary_y='country')
ax.yaxis.tick_right()
Upvotes: 1
Reputation: 494
You can do something like this which will create a second label on the right side of the plot and hide the label on the left side.
ax = df9[(df9['Delivery Quality'] < 0) & (df9['year'] == 2016)][['country','Delivery Quality']].plot(x='country', y='Delivery Quality', kind='barh', figsize=(20,20), legend=False, secondary_y=False)
ax2 = ax.twinx()
ax.set_yticks([])
ax2.set_yticks(df['country'])
Upvotes: 0