I am using matplotlib for a graphing application. I am trying to create a graph which has strings as the X values. However, the using plot function expects a nu
plot
From matplotlib 2.1 on you can use strings in plotting functions.
import matplotlib.pyplot as plt x = ["Apple", "Banana", "Cherry"] y = [5,2,3] plt.plot(x, y) plt.show()
Note that in order to preserve the order of the input strings on the plot you need to use matplotlib >=2.2.