【发布时间】:2021-07-22 03:49:18
【问题描述】:
我有一个数据集,它随着时间的推移跟踪一些位置和一些取决于位置的值,所以我想使用 seaborn 图来显示这些数据。情节是这样的:
这是制作它的代码。我无法共享数据集来制作它,但这是为了让您了解我在做什么。
h = sns.jointplot(data=None,x=dimerDistance,y=Orientation,
kind='hex',cmap="gnuplot",ratio=4,
marginal_ticks=False,marginal_kws=dict(bins=25, fill=False))
plt.suptitle('Orientation Factor - Distance Histogram of Dimer')
plt.tight_layout()
plt.xlabel('Distance [Angstrom]')
plt.ylabel('k')
我想选择一个由 hexbin 函数生成的 bin 并提取占据该 bin 的值。例如,在 x=25 和 y=1.7 左右是根据颜色图具有最高计数的 bin。我想去那个计数最高的 bin,找到这个 bin 中的 x 值和 x 的数组索引,并根据它们的共享索引找到 k 值。或者你可能会说,我想会有一些看起来像的东西
bin[z]=[x[index1],x[index2]....x[indexn]]
其中 z 是计数最高的 bin 的索引,以便我可以创建一个新 bin
newbin=[y[index1],y[index[2]...,y[indexn]]
由于这些数据与时间相关,这些指数会告诉我系统落入垃圾箱的时间范围,因此很高兴知道这一点。我在 Stack 上做了一些窥探。我发现这篇文章似乎很有帮助。 Getting information for bins in matplotlib histogram function
有没有一种方法可以访问我想要的信息?
【问题讨论】:
标签: python matplotlib seaborn histogram jointplot