38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import datetime
|
||
|
|
||
|
import pandas as pd
|
||
|
from matplotlib import pyplot as plt
|
||
|
import matplotlib.dates as md
|
||
|
|
||
|
plt.rcParams["figure.autolayout"] = True
|
||
|
|
||
|
data_frame = pd.read_csv("data.csv", delimiter=';')
|
||
|
|
||
|
# Subplot, to move legend next to plot
|
||
|
# 1 row, 1 col, index: 1
|
||
|
plt.subplot(1,1,1)
|
||
|
|
||
|
# Rotate long date text
|
||
|
plt.xticks(rotation=25)
|
||
|
|
||
|
|
||
|
# pyplot doesn't like timestamps
|
||
|
# convert them to "date-numbers" and format
|
||
|
datenums = md.date2num([datetime.datetime.fromtimestamp(ts) for ts in data_frame.timestamp])
|
||
|
xfmt = md.DateFormatter('%Y-%m-%d %H:%M:%S')
|
||
|
ax=plt.gca()
|
||
|
ax.xaxis.set_major_formatter(xfmt)
|
||
|
ax.set_ylabel('Temperature [°C]')
|
||
|
|
||
|
# Data
|
||
|
plt.plot(datenums, data_frame.tempWarmSide1C, label = 'Warm 1', color = 'orange')
|
||
|
plt.plot(datenums, data_frame.tempWarmSide2C, label = 'Warm 2', color = 'orangered')
|
||
|
plt.plot(datenums, data_frame.tempCoolSide1C, label = 'Cool 1', color = 'blue')
|
||
|
plt.plot(datenums, data_frame.tempCoolSide2C, label = 'Cool 2', color = 'navy')
|
||
|
|
||
|
|
||
|
plt.legend(bbox_to_anchor=(1,1), loc="upper left")
|
||
|
plt.show()
|