Issue #31 resolved

Wrong dimensions in HistStack.hist

Lukas Kreczko
created an issue

When using HistStack.hist getting following error with the easy_install version*.

When switching to repository install the error changes .

The difference between the version is: old: x = np.dstack([hist.x for hist in self.hists]) new: x = np.dstack([hist.x for hist in self.hists])[0]

Doing the same change for contents: old: contents = np.dstack([hist.y for hist in self.hists]) new: contents = np.dstack([hist.y for hist in self.hists])[0]

gets rid of the error.

(*) {{{

!python

Traceback (most recent call last): File "rootplottest.py", line 28, in <module> stack.hist(0,histtype='barstacked') File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rootplot/root2matplotlib.py", line 260, in hist label=labels, kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2332, in hist ret = ax.hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes.py", line 7582, in hist raise ValueError("x must be 1D or 2D") ValueError: x must be 1D or 2D }}}

( ) {{{

!python

Traceback (most recent call last): File "rootplottest.py", line 28, in <module> stack.hist(histtype='barstacked') File "/software/rootplot/lib/rootplot/root2matplotlib.py", line 270, in hist label=labels, kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 2332, in hist ret = ax.hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, kwargs) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes.py", line 7609, in hist raise ValueError("weights must be 1D or 2D") ValueError: weights must be 1D or 2D }}}

Comments (2)

  1. Log in to comment