user3046660
user3046660

Reputation: 81

Increasing size of axis ticks in pandas

I am trying to increase the size of ticks on the y axis, and also the bottom x axis using the following code. However, as shown in the image, its not working. Where am i going wrong, thank you.

plt.rcParams['figure.figsize'] = [40,20]
x = np.linspace(0, 180,180)
x2 = np.linspace(0,360,360)
y1 = df['speed (km/h)']
y2 = df['Speed']

f, ax = plt.subplots(1,1)
ax2 = ax.twiny()

ax.plot(x,y1,color='r', label='A',linewidth=4)
ax2.plot(x2,y2,color='k', label='B',linewidth=4)

plt.xlabel('Time',size = 35)

plt.ylabel ('RPM', size = 45)

ax.legend(loc='upper left', prop={'size': 40})
ax2.legend(loc='upper right', prop={'size': 40})

plt.xticks(size = 30)
plt.yticks(size = 40)

enter image description here

Upvotes: 0

Views: 110

Answers (1)

Aguy
Aguy

Reputation: 8059

Try using

ax.tick_params('x', labelsize = 30)
ax.tick_params('y', labelsize = 40)
ax2.tick_params('x', labelsize = 30)

Upvotes: 1

Related Questions