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

Error when running plot_topic() - Unable to determine Axes to steal space for Colorbar #99

Open
solvi808 opened this issue Sep 29, 2023 · 0 comments

Comments

@solvi808
Copy link

solvi808 commented Sep 29, 2023

Describe the bug
I am running the standard vignette provided in the SCENIC plus tutorial, in jupyter notebook

When I am running plot_topic I get the error ValueError: Unable to determine Axes to steal space for Colorbar. Either provide the *cax* argument to use as the Axes for the Colorbar, provide the *ax* argument to steal space from it, or add *mappable* to an Axes.

This similar error seems to be related to issues with matplotlib and was described ,
shap/shap#2721

It was recommend to install matplotlib version 3.6 but this isnt fixing it in my case

To Reproduce

plot_topic(cistopic_obj, reduction_name = 'UMAP', num_columns=5 )

Error output

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[16], line 1
----> 1 plot_topic(cistopic_obj, reduction_name = 'UMAP', num_columns=5 )

File ~/CORE/VENV/venv_pycisTopic/lib/python3.10/site-packages/pycisTopic/clust_vis.py:728, in plot_topic(cistopic_obj, reduction_name, target, cmap, dot_size, alpha, scale, selected_topics, selected_features, harmony, figsize, num_columns, save)
    726 scalarmappaple = cm.ScalarMappable(norm=normalize, cmap=cmap)
    727 scalarmappaple.set_array(var_data)
--> 728 plt.colorbar(scalarmappaple)
    729 if num_columns == 1:
    730     if save is not None:

File ~/CORE/VENV/venv_pycisTopic/lib/python3.10/site-packages/matplotlib/pyplot.py:2326, in colorbar(mappable, cax, ax, **kwargs)
   2321     if mappable is None:
   2322         raise RuntimeError('No mappable was found to use for colorbar '
   2323                            'creation. First define a mappable such as '
   2324                            'an image (with imshow) or a contour set ('
   2325                            'with contourf).')
-> 2326 ret = gcf().colorbar(mappable, cax=cax, ax=ax, **kwargs)
   2327 return ret

File ~/CORE/VENV/venv_pycisTopic/lib/python3.10/site-packages/matplotlib/figure.py:1285, in FigureBase.colorbar(self, mappable, cax, ax, use_gridspec, **kwargs)
   1283 if cax is None:
   1284     if ax is None:
-> 1285         raise ValueError(
   1286             'Unable to determine Axes to steal space for Colorbar. '
   1287             'Either provide the *cax* argument to use as the Axes for '
   1288             'the Colorbar, provide the *ax* argument to steal space '
   1289             'from it, or add *mappable* to an Axes.')
   1290     fig = (  # Figure of first axes; logic copied from make_axes.
   1291         [*ax.flat] if isinstance(ax, np.ndarray)
   1292         else [*ax] if np.iterable(ax)
   1293         else [ax])[0].figure
   1294     current_ax = fig.gca()

ValueError: Unable to determine Axes to steal space for Colorbar. Either provide the *cax* argument to use as the Axes for the Colorbar, provide the *ax* argument to steal space from it, or add *mappable* to an Axes.

python environment

VENVPATH="./VENV/venv_pycisTopic"

python3.10 -m venv $VENVPATH 
source $VENVPATH/bin/activate 

pip install -U pip wheel setuptools 
pip install -U pip numba matplotlib numpy 
pip install lda 
pip install pyrle 

pip install jupyter

git clone https://github.com/aertslab/pycisTopic.git
cd pycisTopic
pip install .

Versions:
Python 3.10.5
pycisTopic 1.0.3.dev18+ge563fb6
pyscenic 0.12.1+6.g31d51a1
matplotlib 3.8.0
jupyter 1.0.0
jupyterlab 4.0.6

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