ich habe ein Mittelgroßes Problem bei dem ich inzwischen einfach nicht mehr weiter komme. (Ich habe den Eindruck, dass die Lösung vermutlich banal ist, ich aber den Wald vor lauter Bäumen nicht mehr sehe)
Folgendes:
Ich habe ein txt file so:
Code: Alles auswählen
Uhrzeit Bodenfeuchtigkeit Luftfeuchtigkeit[%] Temperatur[°C]
10:52:59 728 72 17
10:53:01 727 72 17
10:53:03 728 72 17
10:53:05 729 72 17
10:53:07 729 72 17
10:53:09 728 72 17
Code: Alles auswählen
import matplotlib.pyplot as plt
import matplotlib.dates as md
import numpy as np
import datetime as dt
import time
import dateutil, pylab
import re
f = open(r'C:\Arduino\Moisture_TEST_1_130513\Log2\130518_1117.txt')
t = []
moisture = []
humidity = []
temp=[]
zeit=[]
for nummer, zeile in enumerate(f):
if nummer>0:
t.append(zeile.split(" ")[0])
moisture.append( zeile.split(" ")[1])
humidity.append( zeile.split(" ")[2])
temp.append( zeile.split(" ")[3])
f.close
Code: Alles auswählen
['10:52:59', '10:53:01', '10:53:03', '10:53:05', '10:53:07', '10:53:09']
Code: Alles auswählen
today = datetime.date.today()
for x in t:
times = map(int, re.split(r"[:]", x))
zeit.append(times[0]*3600+times[1]*60+times[2]+today.year+today.month)
plt.subplots_adjust(bottom=0.2)
plt.xticks(rotation=25)
ax=plt.gca()
xfmt = md.DateFormatter('%H:%M:%S')
ax.xaxis.set_major_formatter(xfmt)
plt.plot(zeit,moisture)
plt.show
(Kann ich hier auch Bilder/Plots hochladen? Bzw hat mir jemand einen Tipp, wo ich es am besten Hochladen kann, damit ich auch meinen Plot hier reinstellen kann...)
Das Problem ist nun eben, dass ich natürlich die Uhrzeit im Plot haben will...
Ich entschultige mich scho vorab für den inzwischen chaotischen code - er ist das Resultat von 4 Tagen Suche im Internet und dem Testen verschiedener Lösungsansätze.
Vielen Dank
Gruß
Stefan