Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run plot_spectrum.py #30

Open
kkitagawaa opened this issue Nov 29, 2024 · 0 comments
Open

Unable to run plot_spectrum.py #30

kkitagawaa opened this issue Nov 29, 2024 · 0 comments

Comments

@kkitagawaa
Copy link

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 kkitagawaa changed the title Unable to plot_spectrum.py Unable to run plot_spectrum.py Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant