ConversionError: Failed to convert value(s) to axis units
dd=pd.DataFrame(np.random.rand(84,3),index=[chr(ascii) for ascii in range(33,33+84)])
dd.plot(kind='area')
plt.xticks(range(0,len(dd.index)), dd.index)
plt.show()
We need to provide index positions of the labels in the xticks function, labels order should be as per the index positions. xticks function takes 3 arguments,
- ticks should be position of indexes of the labels
- labels argument takes the list of label values
- rotation takes how the label should be presented in the plot
x = df['state']
y = df['sales']
tickvalues = range(0,len(x)) // or tickvalues = df.index
plt.figure(figsize = (20,5))
plt.xticks(ticks = tickvalues ,labels = labellist, rotation = 'vertical')
plt.plot(x,y)