Added markers
This commit is contained in:
parent
92eba78afc
commit
8f610063ba
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
data.csv
|
6
data.csv
6
data.csv
@ -1,6 +0,0 @@
|
|||||||
timestamp;tempWarmSide1C;tempWarmSide2C;tempCoolSide1C;tempCoolSide2C
|
|
||||||
1640946129;27.7778;8.33333;-45.0;-145.0
|
|
||||||
1640946131;27.7778;8.33333;-45.0;-145.0
|
|
||||||
1640946133;27.7778;8.33333;-45.0;-145.0
|
|
||||||
1640946135;27.7778;8.33333;-45.0;-145.0
|
|
||||||
1640948789;27.7778;8.33333;-45.0;-145.0
|
|
|
25
graph.py
25
graph.py
@ -12,7 +12,7 @@ data_frame = pd.read_csv("data.csv", delimiter=';')
|
|||||||
|
|
||||||
# Subplot, to move legend next to plot
|
# Subplot, to move legend next to plot
|
||||||
# 1 row, 1 col, index: 1
|
# 1 row, 1 col, index: 1
|
||||||
plt.subplot(1,1,1)
|
plt.subplot(1, 1, 1)
|
||||||
|
|
||||||
# Rotate long date text
|
# Rotate long date text
|
||||||
plt.xticks(rotation=25)
|
plt.xticks(rotation=25)
|
||||||
@ -22,16 +22,27 @@ plt.xticks(rotation=25)
|
|||||||
# convert them to "date-numbers" and format
|
# convert them to "date-numbers" and format
|
||||||
datenums = md.date2num([datetime.datetime.fromtimestamp(ts) for ts in data_frame.timestamp])
|
datenums = md.date2num([datetime.datetime.fromtimestamp(ts) for ts in data_frame.timestamp])
|
||||||
xfmt = md.DateFormatter('%Y-%m-%d %H:%M:%S')
|
xfmt = md.DateFormatter('%Y-%m-%d %H:%M:%S')
|
||||||
ax=plt.gca()
|
ax = plt.gca()
|
||||||
ax.xaxis.set_major_formatter(xfmt)
|
ax.xaxis.set_major_formatter(xfmt)
|
||||||
ax.set_ylabel('Temperature [°C]')
|
ax.set_ylabel('Temperature [°C]')
|
||||||
|
|
||||||
# Data
|
# Data
|
||||||
plt.plot(datenums, data_frame.tempWarmSide1C, label = 'Warm 1', color = 'orange')
|
plt.plot(datenums, data_frame.tempWarmSide1C, label='Warm 1', color='orange', marker='x')
|
||||||
plt.plot(datenums, data_frame.tempWarmSide2C, label = 'Warm 2', color = 'orangered')
|
for i, j in zip(datenums, data_frame.tempWarmSide1C):
|
||||||
plt.plot(datenums, data_frame.tempCoolSide1C, label = 'Cool 1', color = 'blue')
|
ax.annotate(str(round(j, 2)), xy=(i, j), rotation=45)
|
||||||
plt.plot(datenums, data_frame.tempCoolSide2C, label = 'Cool 2', color = 'navy')
|
|
||||||
|
plt.plot(datenums, data_frame.tempWarmSide2C, label='Warm 2', color='orangered', marker='x')
|
||||||
|
for i, j in zip(datenums, data_frame.tempWarmSide2C):
|
||||||
|
ax.annotate(str(round(j, 2)), xy=(i, j), rotation=45)
|
||||||
|
|
||||||
|
plt.plot(datenums, data_frame.tempCoolSide1C, label='Cool 1', color='blue', marker='x')
|
||||||
|
for i, j in zip(datenums, data_frame.tempCoolSide1C):
|
||||||
|
ax.annotate(str(round(j, 2)), xy=(i, j), rotation=45)
|
||||||
|
|
||||||
|
plt.plot(datenums, data_frame.tempCoolSide2C, label='Cool 2', color='navy', marker='x')
|
||||||
|
for i, j in zip(datenums, data_frame.tempCoolSide2C):
|
||||||
|
ax.annotate(str(round(j, 2)), xy=(i, j), rotation=45)
|
||||||
|
|
||||||
|
|
||||||
plt.legend(bbox_to_anchor=(1,1), loc="upper left")
|
plt.legend(bbox_to_anchor=(1, 1), loc="upper left")
|
||||||
plt.show()
|
plt.show()
|
||||||
|
Loading…
Reference in New Issue
Block a user