Using below code I'm attempting to plot x axis values as strings with matplotlib :
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
fig = plt.figure()
plt.figure(figsize=(20,10))
plt.xticks(fontsize=24)
plt.yticks(fontsize=24)
plt.plot( 'x', 'y', data=pd.DataFrame({'x': np.array(['a' , 'b' , 'c']) , 'y': np.array([1,2,3]) }), marker=None, color='blue')
plt.show()
This error is returned :
ValueError: could not convert string to float: 'c'
It appears matplotlib is inferring the axis value as string. How to change this ?
I've tried setting the type but this does not fix :
astype(str)