Import plot script
This commit is contained in:
parent
abe8b2a91e
commit
c35da3facc
1 changed files with 8 additions and 4 deletions
|
@ -1,6 +1,8 @@
|
|||
import sqlite3
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.dates as mdates
|
||||
import numpy as np
|
||||
import datetime
|
||||
|
||||
con = sqlite3.connect("data.db")
|
||||
cur = con.cursor()
|
||||
|
@ -11,11 +13,13 @@ x_values = []
|
|||
y_values = []
|
||||
|
||||
for time, watts in res:
|
||||
x_values.append(time)
|
||||
x_values.append(datetime.datetime.fromtimestamp(time / 1000))
|
||||
y_values.append(watts)
|
||||
|
||||
plt.plot(x_values, y_values)
|
||||
|
||||
plt.ylim([0, 200])
|
||||
fig, ax = plt.subplots()
|
||||
ax.plot(x_values, y_values)
|
||||
plt.tick_params(rotation=45)
|
||||
ax.xaxis.set_major_formatter(mdates.DateFormatter("%H:%M - %d.%m"))
|
||||
|
||||
plt.ylim([0, max(y_values) + 50])
|
||||
plt.show()
|
Loading…
Reference in a new issue