rootpy と matplotlib を使用して ROOT 2D ヒストグラムをプロットしようとしています。
これに使用するコードは次のとおりです。
from rootpy.io import File
from rootpy.plotting import Hist
import rootpy.plotting.root2matplotlib as rplt
import matplotlib.pyplot as plt
inputFile = File('mydata.root', 'read')
h_response = inputFile.myfolder.response
plt.figure(figsize=(16, 10), dpi=100)
rplt.hist(h_response, label='response matrix')
h_response.Draw()
plt.xlabel('reconstructed $E_{\mathrm{T}}^{miss}$')
plt.ylabel('Generated $E_{\mathrm{T}}^{miss}$')
plt.title('Response Matrix')
plt.savefig('ResponseMatrix.png')
ただし、これによりエラーメッセージが表示されます。
Traceback (most recent call last):
File "/storage/Dropbox/Workspace/Analysis/DailyPythonScripts/src/unfolding.py", line 66, in <module>
rplt.hist(h_response, label='response matrix')
File "/usr/local/lib/python2.7/dist-packages/rootpy-0.7.0_a0-py2.7-linux-x86_64.egg/rootpy/plotting/root2matplotlib.py", line 140, in hist
snap_zero=snap_zero)
File "/usr/local/lib/python2.7/dist-packages/rootpy-0.7.0_a0-py2.7-linux-x86_64.egg/rootpy/plotting/root2matplotlib.py", line 82, in _set_bounds
ywidth = ymax - ymin
TypeError: unsupported operand type(s) for -: 'list' and 'list'
明らかに、私は間違った rootpy2matplotlib モジュールを使用しているので、調べてみました: モジュールが提供するもの: hist、bar、および errorbar 関数 - >= 2D に固有のものではありません。
何か不足していますか?簡単な回避策はありますか?
PS: この質問に「rootpy」タグを付けたいのですが、できません。この質問は非常に具体的であるため、申し訳ありません。