squib1996
squib1996

Reputation: 67

Xtick labels won't rotate?

I am not able to get my x tick labels to rotate, currently they overal

I have tried (shown in code, to use the rotation argument, I have tried working with plt.setp and trying to rotate within the first plot argument. If i only have one axis then It plots perfectly, it's the secondary axis that causes the issue for some reason

df_summary['AV_PRICE'] = np.random.randint(30, 150, size=len(df_summary))
plt.figure
df_summary.plot(kind='bar',x='BMCODE_type',y = 'AV_DURATION',xticks=[])
df_summary['AV_PRICE'].plot(secondary_y=True, 
legend='TRUE',style='g',ax=None, mark_right=False,xticks=[])
loc = range(len(df_summary))
plt.xticks(loc,df_summary['BMCODE_type'],rotation='vertical')

I would like the labels to be vertical rather than horizontal, any ideas would be great!

Upvotes: 2

Views: 757

Answers (1)

Arturo Sbr
Arturo Sbr

Reputation: 6333

I know it's 8 months too late, but...

Use the rot argument when plotting the secondary axis and set it to 90:

df_summary['AV_PRICE'].plot(secondary_y=True, legend='TRUE', style='g',
                            ax=None, mark_right=False,xticks=[], rot=90)

Upvotes: 1

Related Questions