-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplot-final.py
More file actions
28 lines (21 loc) · 862 Bytes
/
Copy pathplot-final.py
File metadata and controls
28 lines (21 loc) · 862 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
import numpy as np
import matplotlib.pyplot as plt
acc = np.load('./acc.npy')
acc = np.reshape(acc, (4, 3))
n_groups = 3
fig, ax = plt.subplots()
index = np.arange(n_groups)
bar_width = 0.18
opacity = 0.4
error_config = {'ecolor': '0.3'}
r1 = plt.bar(index, tuple(acc[0]), bar_width, alpha=opacity, color='b', label='Chroma')
r2 = plt.bar(index + bar_width, tuple(acc[1]), bar_width, alpha=opacity, color='r', label='Perceptual')
r3 = plt.bar(index + 2 * bar_width, tuple(acc[2]), bar_width, alpha=opacity, color='g', label='Spectral')
r4 = plt.bar(index + 3 * bar_width, tuple(acc[3]), bar_width, alpha=opacity, color='y', label='Others')
plt.xlabel('Feature Reduction')
plt.ylabel('Accuracy')
plt.title('Accuracy vs Feature Reduction Algorithm Plot')
plt.xticks(index + 3 * bar_width / 2, ('No', 'PCA', 'LDA'))
plt.legend()
plt.tight_layout()
plt.show()