Marsilea-viz / marsilea

Declarative creation of composable visualization for Python (Complex heatmap, Upset plot, Oncoprint and more~)
https://marsilea.rtfd.io/
MIT License
174 stars 6 forks source link

`get_colormap` still fails due to API changes in `matplotlib`, in release `v0.4.1` #36

Closed Fantasque68 closed 5 months ago

Fantasque68 commented 5 months ago

Hi there, thank you for developing this helpful visualization package. Also, it's very nice of you to try to cope with the change of API of matplotlib == 3.9.0, as mentioned in issue #35, release v0.4.1.

However, I found that changes in v0.4.1 might not practicable. It still raises errors associated with API changes of matplotlib.

I met the following errors when I used a package called decoupleR which called Heatmap function in marsilea. The version of my packages is marsilea == 0.4.1, matplotlib == 3.9.0.

  1. In utils.py, line 75, your code return mpl.colormap.get(cmap) will lead to an error called AttributeError: module 'matplotlib' has no attribute 'colormap'
  2. In utils.py, line 78, your code return mpl.cm.get_cmap(cmap) will lead to an error called AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'
  3. In utils.py, line 80, your code return mpl.cm.ColormapRegistry.get_cmap(cmap) will lead to an error called TypeError: get_cmap() missing 1 required positional argument: 'cmap'

I'm not sure whether I'm right, but the code run pretty well after I changed the utils.py as follows.

# Release 0.4.1
return mpl.colormap.get(cmap) # line 75

# Change
return mpl.colormaps.get(cmap) # line 75

Looking forward to hear from you. Thanks!

Mr-Milk commented 5 months ago

Thanks for reporting this, I will take a closer look.