我有一个具有三维坐标(经度、纬度、海拔(的pandas Dataframe,并使用hexbin(经度、经度、0.0001(创建hex_file((的源。我看了教程,其中fill_color计算为linear_cmap('counts', 'Viridis256', 0, max(bins.counts))
。我如何通过箱中点的平均高度来给六角体上色,而不是计数?
多亏了bigreddot的提示,我能够做到:
from bokeh.util.hex import cartesian_to_axial
q, r = cartesian_to_axial(df["longitude"].values, df["latitude"].values, 0.0001, "pointytop")
df2 = pandas.DataFrame(dict(r=r, q=q, a=df["altitude"]))
gb = df2.groupby(['q', 'r']).mean().reset_index()
然后使用gb作为CCD_ 2的源;a";作为linear_cmap()
的值