-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser2.py
More file actions
39 lines (30 loc) · 890 Bytes
/
parser2.py
File metadata and controls
39 lines (30 loc) · 890 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
import csv,sys,os
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
input=sys.argv[1]
print("read csv")
df = pd.read_csv(input)
print(df.head())
print("melt data")
df_long = df.melt(id_vars =["label"], var_name = "time", value_name ="power")
print(df['label'].value_counts())
plt.figure(figsize = (12,7))
sns.relplot(data=df_long,x="time",y="power",hue="label",kind="line")
pg_png='power_graph.png'
mg_png='multi_graph.png'
print("save to ",pg_png)
plt.savefig(pg_png)
#plt.figure(figsize = (12,12))
sns.relplot(x="time", y="power",
col="label", col_wrap=4,
height=3, aspect=.75, linewidth=2.5,
kind="line", data=df_long)
print("save to ",mg_png)
plt.savefig(mg_png)
exit(1)
g = sns.FacetGrid(df_long, col="label", col_wrap=2, height=2 )
print("map data")
g.map(sns.lineplot, "time","power")
print("save figure ")