Ich brauche Text auf der X-Achse in Matplotlib Grafik. Ich habe:Hinzufügen von Text in Balkendiagramm in Matplotlib (Python)
import matplotlib.pyplot as plt
x=[1,2,3,4,5,6,7,8,9,10,11,12]
y=[5.3, 6.1, 25.5, 27.8, 31.2, 33.0, 33.0, 32.8, 28.4, 21.1, 17.5, 11.9]
plt.bar(x,y, color='g')
plt.xlabel('x')
plt.ylabel('y')
plt.title("Max Temperature for Months")
plt.legend()
plt.show()
Und meine Ausgabe lautet:
Ich weiß nicht, wie x=[ ]
Liste mit Text (Strings) zu ersetzen, es gibt mir Fehler.
Meine gewünschte Diagramm ist:
Können Sie meine Antwort akzeptieren, wenn es hilfreich war? Danke – Chuck