Wie stelle ich die Achsengrenzen in Matplotlib ein?
Posted: 08 Feb 2025, 18:00
Ich brauche Hilfe bei der Festlegung der Grenzen der y-Achse auf Matplotlib. Hier ist der Code, den ich erfolglos ausprobiert habe.
Mit den Daten, die ich für dieses Diagramm habe, erhalte ich Y-Achse-Grenzen von 20 und 200. Ich möchte jedoch, dass die Grenzen 20 und 250 sind.
Code: Select all
import matplotlib.pyplot as plt
plt.figure(1, figsize = (8.5,11))
plt.suptitle('plot title')
ax = []
aPlot = plt.subplot(321, axisbg = 'w', title = "Year 1")
ax.append(aPlot)
plt.plot(paramValues,plotDataPrice[0], color = '#340B8C',
marker = 'o', ms = 5, mfc = '#EB1717')
plt.xticks(paramValues)
plt.ylabel('Average Price')
plt.xlabel('Mark-up')
plt.grid(True)
plt.ylim((25,250))