1. Jeff Klukas
  2. rootplot
  3. Issues
Issue #23 resolved

AssertionError: incompatible sizes: argument 'bottom' must be length 10 or scalar

ajabberwok
created an issue

I'm now getting a pretty crazy error.

There is one main thing I'm doing different that in the past: I'm now using custom bin sizes. The root files I attached contain histograms (named "photon_pt") with custom bins.

{{{

!bash

rootplotmpl rootplotmpl_Wenu_config.py --ymin=0.1 -m --legend-location="upper right" -e pdf ran setTDRStyle() [12, 10, 10, 10] [12, 10, 10, 10] Process Process-2: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/multiprocessing/process.py", line 232, in _bootstrap self.run() File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/multiprocessing/process.py", line 88, in run self._target(self._args, self._kwargs) File "<string>", line 274, in qfunc File "<string>", line 2, in <module> File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/core.py", line 594, in plotmpl return plot(*args, kwargs) File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/core.py", line 619, in plot return plot_hists_mpl(hists, options) File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/core.py", line 1118, in plot_hists_mpl label_alignment=options.xlabel_alignment) File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/root2matplotlib.py", line 299, in barstack Process Process-5: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/multiprocessing/process.py", line 232, in _bootstrap self.run() File "/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/multiprocessing/process.py", line 88, in run self._target(self._args, self._kwargs) File "<string>", line 274, in qfunc File "<string>", line 2, in <module> File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/core.py", line 594, in plotmpl return plot(*args, kwargs) File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/core.py", line 619, in plot return plot_hists_mpl(hists, options) File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/core.py", line 1118, in plot_hists_mpl label_alignment=options.xlabel_alignment) File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/root2matplotlib.py", line 299, in barstack bar = hist.bar(bottom=bottom, all_kwargs) File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/root2matplotlib.py", line 201, in bar label=replace(self.label, replacements), kwargs) File "/Library/Python/2.6/site-packages/matplotlib/pyplot.py", line 1742, in bar bar = hist.bar(bottom=bottom, all_kwargs) File "/Users/michaelanderson/Documents/Work/rootplot/lib/rootplot/root2matplotlib.py", line 201, in bar label=replace(self.label, replacements), kwargs) File "/Library/Python/2.6/site-packages/matplotlib/pyplot.py", line 1742, in bar ret = ax.bar(left, height, width, bottom, color, edgecolor, linewidth, yerr, xerr, ecolor, capsize, align, orientation, log, kwargs) File "/Library/Python/2.6/site-packages/matplotlib/axes.py", line 4249, in bar ret = ax.bar(left, height, width, bottom, color, edgecolor, linewidth, yerr, xerr, ecolor, capsize, align, orientation, log, kwargs) File "/Library/Python/2.6/site-packages/matplotlib/axes.py", line 4249, in bar nbars) AssertionError: incompatible sizes: argument 'bottom' must be length 10 or scalar nbars) AssertionError: incompatible sizes: argument 'bottom' must be length 10 or scalar 2 plots of 60 written to plots/ in pdf format [30, 5, 5, 5] }}}

Comments (2)

  1. ajabberwok reporter

    Upon further investigation, I think one of the several root files for some reason I had created with a different custom bins. Maybe rootplot can catch that and report it better?

  2. Jeff Klukas repo owner

    I added in a check in HistStack.add. Your problem will now generate this message:

    ValueError: Cannot add h_photon_phi to stack; all Hists must have the same binning.

  3. Log in to comment