crafter icon indicating copy to clipboard operation
crafter copied to clipboard

Unable to run plot_spectrum.py

Open kkitagawaa opened this issue 1 year ago • 0 comments

The error:

Traceback (most recent call last): File "/home/kitagawa/crafter-planning/envs/original_crafter/analysis/plot_spectrum.py", line 66, in plot_spectrum(inpaths, "plots/spectrum-reward.pdf", legend, colors) File "/home/kitagawa/crafter-planning/envs/original_crafter/analysis/plot_spectrum.py", line 30, in plot_spectrum ax.bar(pos, heights, width / len(methods), label=label, color=color) File "/home/kitagawa/.cache/pypoetry/virtualenvs/crafter-planning-NCB5HBx2-py3.10/lib/python3.10/site-packages/matplotlib/init.py", line 1473, in inner return func( File "/home/kitagawa/.cache/pypoetry/virtualenvs/crafter-planning-NCB5HBx2-py3.10/lib/python3.10/site-packages/matplotlib/axes/_axes.py", line 2520, in bar x, height, width, y, linewidth, hatch = np.broadcast_arrays( File "/home/kitagawa/.cache/pypoetry/virtualenvs/crafter-planning-NCB5HBx2-py3.10/lib/python3.10/site-packages/numpy/lib/_stride_tricks_impl.py", line 558, in broadcast_arrays shape = _broadcast_shape(*args) File "/home/kitagawa/.cache/pypoetry/virtualenvs/crafter-planning-NCB5HBx2-py3.10/lib/python3.10/site-packages/numpy/lib/_stride_tricks_impl.py", line 433, in _broadcast_shape b = np.broadcast(*args[:32]) ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between arg 0 with shape (3,) and arg 1 with shape (3, 15, 22).

It seems that the shape of heights does not match that of pos. How can we change the code and make it run?

kkitagawaa avatar Nov 29 '24 07:11 kkitagawaa