1

http://matplotlib.org/examples/pylab_examples/hist2d_log_demo.htmlのように、matplotlib の hist2d() を使用して 2D ヒストグラムを別々にプロットしている 2 つのデータ セットがあります。ここで、これら 2 つの 2D ヒストグラムの比率 (つまり、頻度の比率) を取得したいと考えています。matplotlib でこれを達成するにはどうすればよいですか?

4

1 に答える 1

0

を内部的 hist2dに使用しnumpy.histogram2dます。したがって、この関数を使用して両方のヒストグラムを計算し、比率を計算してからpcolormeshimshowなどを使用してプロットできます。

h1, xedges, yedges = np.histogram2d(x1, y1, bins=bins)
h2, xedges, yedges = np.histogram2d(x2, y2, bins=bins)
h = h1 / h2
pc = ax.pcolorfast(xedges, yedges, h.T)
于 2015-02-03T21:21:00.057 に答える