-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_num_mal.py
34 lines (27 loc) · 1.16 KB
/
plot_num_mal.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
29
30
31
32
33
34
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# Make a data frame
df = pd.DataFrame({'x': range(1, 11), 'y1': np.random.randn(10), 'y2': np.random.randn(10) + range(1, 11),
'y3': np.random.randn(10) + range(11, 21), 'y4': np.random.randn(10) + range(6, 16),
'y5': np.random.randn(10) + range(4, 14) + (0, 0, 0, 0, 0, 0, 0, -3, -8, -6),
'y6': np.random.randn(10) + range(2, 12), 'y7': np.random.randn(10) + range(5, 15),
'y8': np.random.randn(10) + range(4, 14), 'y9': np.random.randn(10) + range(4, 14),
'y10': np.random.randn(10) + range(2, 12)})
# Change the style of plot
# plt.style.use('seaborn-darkgrid')
# Create a color palette
palette = plt.get_cmap('Set1')
# Plot multiple lines
num = 0
for column in df.drop('x', axis=1):
num += 1
plt.plot(df['x'], df[column], marker='', color=palette(num), linewidth=1, alpha=0.9, label=column)
# Add legend
plt.legend(loc=2, ncol=2)
# Add titles
plt.title("A (bad) Spaghetti plot", loc='left', fontsize=12, fontweight=0, color='orange')
plt.xlabel("Time")
plt.ylabel("Score")
# Show the graph
plt.show()