【发布时间】:2018-05-08 16:15:34
【问题描述】:
考虑以下数据框,
d = {'Score': [0.25, 0.52, 0.26, 0.22, 0.31, 2.45, 3.68, 41.3, 87, 91],
'Thr1': 16.5,
'Thr2': 45.5,
'Anomaly':[0, 0, 0, 0, 0, 0, 0, 1, 1, 1]}
df = pd.DataFrame(data = d)
我要做的是绘制一个极坐标图,用虚线表示阈值,或用多条虚线表示多个阈值,并用不同的颜色表示异常。到目前为止,我得到的是,
r = df['Score']
theta = df.index.values
fig = plt.figure()
ax = fig.add_subplot(111, projection = 'polar')
c = ax.scatter(theta, r)
我无法获得阈值并更改异常点的颜色。有什么想法吗?
【问题讨论】:
-
您希望得到什么?类似this
-
@varren 完全正确,但第一个限制之外的第一个点应该是...黄色
标签: python python-3.x pandas matplotlib