我有一个数据帧,看起来像:
Value Std Reciever type
Station ID
ABMF 3.588 0.492 TRIMBLE NETR9
AIRA 8.820 0.256 TRIMBLE NETR9
AREG 7.306 0.356 TRIMBLE NETR9
BRST 6.712 0.166 TRIMBLE NETR9
BRUX 3.151 0.151 SEPT POLARX4TR
... ... ...
WTZR 12.374 0.158 LEICA GRX1200+GNSS
WTZZ 1.906 0.179 JAVAD TRE_G3TH DELTA
WUH2 4.422 0.534 JAVAD TRE_G3TH DELTA
ZIM2 11.244 0.171 TRIMBLE NETR5
ZIM3 11.971 0.185 TRIMBLE NETR9
[80 rows x 3 columns]
我正在尝试创建基于聚合的可视化,如下所示:
df = (df.groupby(by=['Station ID'])
.agg({'Value': np.average, 'Std': np.average, 'Reciever type': 'first'})
)
dcb_plot = plt.figure(figsize=(16,9))
plt.title('Receiver Code Biases for {} station(s) ({})'.format(station, year))
plt.xlabel('Station(s)')
plt.ylabel('DCB in ns')
plt.errorbar(df.index, df['Value'], yerr=df['Std'], marker='o', fmt='o', ms=5, capsize=5, elinewidth=1)
ax = plt.gca()
ax.axes.xaxis.set_ticklabels([])
ax.yaxis.set_minor_locator(AutoMinorLocator())
ax.tick_params(which='major', length=8)
ax.tick_params(which='minor', length=4, color='r')
我想根据Reciever type
列中的值创建colormap(彩色错误条也不错)。我该怎么做?
为了更好地理解,这是我想要的输出:
关键是从颜色贴图生成颜色。我这里不使用df,但它应该很容易适应您的数据
相关问题 更多 >
编程相关推荐