AttributeError: ‘ColormapRegistry‘ object has no attribute ‘get_cmap‘ stlearn scanpy

I got this error when running scanpy on local juypter under a windows system.

My small environment is stlearn2

This is a problem that occurs when scanpy calls a function of the matplotlib library . get_cmap is a function in matplotlib that is used to obtain a color map with a specified name.

2 Solution
This may be due to the constant upgrading of matplotlib, which has caused some functions to change their locations (possible reasons). Now the get_cmap function is in matplotlib.cm

The specific solutions are as follows:

1) Find the problematic file ./scanpy/plotting/_tools/scatterplots.py in the scanpy library folder and open it

I put red dots on the changed places. 

After restarting jupyter lab, it can run normally.

Guess you like

Origin blog.csdn.net/qq_52813185/article/details/135091266