Upload files to "/"
Signed-off-by: enderice2 <enderice2@no-reply@enderice2.com>
This commit is contained in:
39
graph.py
Normal file
39
graph.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import pandas as pd
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
data = pd.read_csv("sensors_log.csv")
|
||||
|
||||
data['timestamp'] = pd.to_datetime(data['timestamp'])
|
||||
|
||||
data.set_index('timestamp', inplace=True)
|
||||
|
||||
plt.style.use('dark_background')
|
||||
|
||||
columns_to_plot = {
|
||||
'CPU (°C)': 1,
|
||||
'Vcore (V)': 0.01,
|
||||
'VSOC (V)': 0.01,
|
||||
'VDDP (mV)': 5,
|
||||
'DRAM (V)': 0.01,
|
||||
}
|
||||
|
||||
for column, threshold in columns_to_plot.items():
|
||||
plt.figure(figsize=(12, 6))
|
||||
plt.plot(data.index, data[column], label=column, color='cyan', linewidth=2)
|
||||
|
||||
last_labeled_value = None
|
||||
for x, y in zip(data.index, data[column]):
|
||||
if last_labeled_value is None or abs(y - last_labeled_value) > threshold:
|
||||
plt.text(x, y, f"{y:.2f}", fontsize=9, ha='center', va='bottom', color='white')
|
||||
last_labeled_value = y
|
||||
|
||||
plt.xlabel("Timestamp", fontsize=12, color='white')
|
||||
plt.ylabel("Value", fontsize=12, color='white')
|
||||
plt.title(f"{column} Over Time", fontsize=14, color='white')
|
||||
plt.legend(loc='upper left')
|
||||
plt.grid(visible=True, color='gray', linestyle='--', alpha=0.7)
|
||||
plt.tight_layout()
|
||||
|
||||
plt.savefig(f"{column}_graph_no_points_dark.png", dpi=300)
|
||||
plt.show()
|
Reference in New Issue
Block a user