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

[Bug]: Module 'matplotlib.cm' has no attribute 'get_cmap' #14

Open
liofeu opened this issue Aug 23, 2024 · 0 comments
Open

[Bug]: Module 'matplotlib.cm' has no attribute 'get_cmap' #14

liofeu opened this issue Aug 23, 2024 · 0 comments

Comments

@liofeu
Copy link

liofeu commented Aug 23, 2024

When running the prediction:
python start_prediction.py *PathToConfigFile*

I get an error ar line 133 in summary.py:

Traceback (most recent call last):
  File "/Users/lionel/Lionoil/Research/2208_whitefly/ANIMAL-SPOT-master/ANIMAL-SPOT/predict.py", line 348, in <module>
    plot_spectrogram(spectrogram=input.cpu().squeeze(dim=0).squeeze(dim=0), title="Spectrogram",
  File "/Users/lionel/Lionoil/Research/2208_whitefly/ANIMAL-SPOT-master/ANIMAL-SPOT/utils/summary.py", line 133, in plot_spectrogram
    kwargs.setdefault("cmap", plt.cm.get_cmap("viridis"))
                              ^^^^^^^^^^^^^^^
AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'

matplotlib.cm.get_cmap(name) has been removed from matplotlib.cm. Instead, you can use matplotlib.colormaps[name] or matplotlib.colormaps.get_cmap(name)

I solved the issue by changing line 133 in summary.py:
kwargs.setdefault("cmap", plt.cm.get_cmap("viridis"))
to
kwargs.setdefault("cmap", plt.colormaps.get_cmap("viridis"))

Tested on macOS 10.15 / python3

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