-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.py
29 lines (24 loc) · 983 Bytes
/
plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.dates as mdates
def main():
plt.xkcd()
df = pd.read_csv("./detailed_usage.csv", sep=',', header=None)
df.columns = ['user', 'usage', 'total', 'max', 'timestamp']
df['timestamp'] = pd.to_datetime(df['timestamp'])
current = df.iloc[-1]['total']
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(15, 13) )
sns.lineplot(x='timestamp', y='usage', hue='user', data=df, ax=ax)
ax.xaxis.set_major_locator(mdates.HourLocator(interval = 1))
ax.xaxis.set_major_formatter(mdates.DateFormatter('%m/%d-%H:%M'))
ax.set_title(f"Main GPU Usage - currently {current}MB", fontsize=35)
ax.set_xlabel("Timestamp", fontsize=35)
ax.set_ylabel("Memory Usage (MB)", fontsize=35)
ax.set_ylim(0, df.iloc[0]['max'])
ax.tick_params(axis='x', rotation=40)
plt.grid()
plt.savefig("status.png")
plt.close('all')
if __name__ == "__main__":
main()