Schleife im subplott
Verfasst: Mittwoch 12. Dezember 2018, 12:10
Hallo,
ich hab gerade folgendes Problem.
Ich arbeite viel mit subplotts, und möchte die Befehle nicht unter jeden subplott einzeln schreiben.
Habe es mit i in range() ausprobiert, aber bekomme Fehlermeldungen und Python reagiert nicht mehr.
Fehlermeldung ist dann': No handles with labels found to put in legend.
Kann mir einer sagen, wie das mit i in range(0) richtig geht? Das würde dauerhaft viel Arbeit ersparen.
Danke
ich hab gerade folgendes Problem.
Ich arbeite viel mit subplotts, und möchte die Befehle nicht unter jeden subplott einzeln schreiben.
Habe es mit i in range() ausprobiert, aber bekomme Fehlermeldungen und Python reagiert nicht mehr.
Code: Alles auswählen
fig,ax=plt.subplots(7,1)
df['TI111'].plot(ax=ax[0])
df['TI112'].plot(ax=ax[0])
df['TI113'].plot(ax=ax[0])
df['TI114'].plot(ax=ax[0])
df['TI115'].plot(ax=ax[0])
df['TI116'].plot(ax=ax[0])
for i in range(6):
ax[i].legend()
ax[i].grid(True)
ax[i].set_ylim([20, 210])
ax[i].set_xlim(['2018-12-11 12:38:00', '2018-12-11 13:51:00'])
ax[i].set_title('Temperaturfühler A')
ax[i].set_xlabel('Time[s]')
ax[i].set_ylabel('Temperature [°C]')
df['TI117'].plot(ax=ax[1])
df['TI118'].plot(ax=ax[1])
df['TI119'].plot(ax=ax[1])
df['TI120'].plot(ax=ax[1])
df['TI121'].plot(ax=ax[1])
df['TI122'].plot(ax=ax[1])
df['TI123'].plot(ax=ax[2])
df['TI124'].plot(ax=ax[2])
df['TI125'].plot(ax=ax[2])
df['TI126'].plot(ax=ax[2])
df['TI127'].plot(ax=ax[2])
df['TI128'].plot(ax=ax[2])
df['TI129'].plot(ax=ax[3])
df['TI130'].plot(ax=ax[3])
df['TI131'].plot(ax=ax[3])
df['TI132'].plot(ax=ax[3])
df['TI133'].plot(ax=ax[3])
df['TI134'].plot(ax=ax[3])
df['TI135'].plot(ax=ax[4])
df['TI136'].plot(ax=ax[4])
df['TI137'].plot(ax=ax[4])
df['TI138'].plot(ax=ax[4])
df['TI139'].plot(ax=ax[4])
df['TI140'].plot(ax=ax[4])
df['TI141'].plot(ax=ax[5])
df['TI142'].plot(ax=ax[5])
df['TI143'].plot(ax=ax[5])
df['TI144'].plot(ax=ax[5])
df['TI145'].plot(ax=ax[5])
df['TI146'].plot(ax=ax[5])
df['TI101'].plot(ax=ax[6])
df['TI102'].plot(ax=ax[6])
df['TI103'].plot(ax=ax[6])
df['TI104'].plot(ax=ax[6])
df['TI105'].plot(ax=ax[6])
df['TI106'].plot(ax=ax[6])
df['TI107'].plot(ax=ax[6])
df['TI108'].plot(ax=ax[6])
df['TI109'].plot(ax=ax[6])
df['TI110'].plot(ax=ax[6])
df['TI147'].plot(ax=ax[6])
Kann mir einer sagen, wie das mit i in range(0) richtig geht? Das würde dauerhaft viel Arbeit ersparen.
Danke