5

I have two arrays, x and y, both with values within a well defined range. I am able to create a hexbin plot (see image), however, I would now like to normalize these distributions and draw contour plots around them. I am not so interested in the counts within each hexbin. Instead I am interested in showing the contours corresponding to 1, 2 and 3 standard deviations (σ). I hope to have an output showing the contours similar to this example. The distribution is Gaussian. I would greatly appreciate any input on this.

4

2 回答 2

0

根据 hexbin 文档https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.hexbin.html,您应该能够访问箱的 (x,y) 位置和返回的值多变的。例如:

h = hexbin(...)
xy = h.get_offsets()
v = h.get_array()

您可以使用这些来绘制轮廓。

请注意,文档不正确并说get_offset()应该调用,但该函数不存在,它是get_offsets().

此外,当hexbinxscale='log'and调用时yscale='log'get_offsets()则只返回array([[0., 0.]])

于 2020-07-23T22:54:56.827 回答
-3

我已经回答了其他人,如何创建等高线图。请检查已回答问题的以下链接。如果您有任何其他问题或想法,请随时在评论中提问。我会尽快回复。

于 2012-07-25T07:54:07.353 回答