-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfeature_dist.py
More file actions
39 lines (27 loc) · 1.06 KB
/
feature_dist.py
File metadata and controls
39 lines (27 loc) · 1.06 KB
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
# @Author : Andrian Lee
# @Time : 2021/12/12 15:13
# @File : plotting.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.decomposition import PCA
plt.rcParams['savefig.dpi'] = 300
plt.rcParams['figure.dpi'] = 300
sns.set_theme(style="darkgrid")
df = pd.read_excel("./dataset/all_data_20220606.xlsx", sheet_name='train')
# df = df[df['train_test'] == 0]
# 0, 1
color_list = ['#EF90B9', '#85B4FF']
fig = plt.figure(figsize=(10, 10)) # figsize=(2, 4)
for idx, i in enumerate(df.columns[10:19]):
print(idx, (int((idx) / 3) * 4 + ((idx) % 3) + 1))
ax = fig.add_subplot(3, 5, (int((idx) / 3) * 5 + ((idx) % 3) + 1))
sns.violinplot(x="label", y=i, data=df, ax=ax, palette=color_list, ) # width=0.2, linewidth=1
ax = plt.subplot2grid((3, 5), (0, 3), colspan=2, rowspan=2)
sns.violinplot(x="label", y=df.columns[19], data=df, ax=ax, palette=color_list)
ax.set_ylabel("H$_{2}$O (ppm)")
plt.tight_layout()
plt.savefig("./feature_dist.png") # TODO: customized
plt.show()
# figure,ax=plt.subplots(2,2)