-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraph.py
36 lines (25 loc) · 950 Bytes
/
graph.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
35
36
import numpy as np
from base import data
import matplotlib.pyplot as plt
data = data.astype({'time_index': 'datetime64[ns]'})
# tmp flt
data = data[data['task_mark'] == 'task_1']
# rnm columns
data = data.rename(columns={1:'lim_outl'})
# decimals = num - int(num)
data['color'] = np.where(data.lim_outl - data.lim_outl.astype(int) != 0, 'r', 'k')
fig, ax = plt.subplots(figsize=(12, 6), layout='constrained')
#data draw
ax.plot(data['time_index'].values, data['vals'].values, linewidth=0.5)
#outlier draw
ax.scatter(data['time_index'].values, data['out_task'].values, marker='o', color='r')
#outlier limits line draw
ax.plot(data['time_index'].values, data['lim_outl'].values, color='k', dashes=[0, 1, 1], linewidth=0.5)
#outlier limits scatter draw color=data['color'].values
ax.scatter(data['time_index'].values, data['lim_outl'].values, marker='2', color=data['color'].values, s=0.69)
plt.xticks(rotation=90)
#
#
#
plt.grid()
plt.show()