scenicplus icon indicating copy to clipboard operation
scenicplus copied to clipboard

Error with plot_topic

Open Chrisdoan9 opened this issue 1 year ago • 4 comments

Hi all,

I try to run the tutorial but got this error. Would you have a suggestion?

To Reproduce plot_topic(cistopic_obj, reduction_name = 'UMAP', num_columns = 4)

Error output

ValueError                                Traceback (most recent call last)
Input In [45], in <cell line: 1>()
----> 1 plot_topic(cistopic_obj, reduction_name = 'UMAP', num_columns = 4)

File ~/pycisTopic/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 ~/.local/lib/python3.9/site-packages/matplotlib/pyplot.py:2053, in colorbar(mappable, cax, ax, **kwargs)
   2048     if mappable is None:
   2049         raise RuntimeError('No mappable was found to use for colorbar '
   2050                            'creation. First define a mappable such as '
   2051                            'an image (with imshow) or a contour set ('
   2052                            'with contourf).')
-> 2053 ret = gcf().colorbar(mappable, cax=cax, ax=ax, **kwargs)
   2054 return ret

File ~/.local/lib/python3.9/site-packages/matplotlib/figure.py:1256, in FigureBase.colorbar(self, mappable, cax, ax, use_gridspec, **kwargs)
   1254 if cax is None:
   1255     if ax is None:
-> 1256         raise ValueError(
   1257             'Unable to determine Axes to steal space for Colorbar. '
   1258             'Either provide the *cax* argument to use as the Axes for '
   1259             'the Colorbar, provide the *ax* argument to steal space '
   1260             'from it, or add *mappable* to an Axes.')
   1261     current_ax = self.gca()
   1262     userax = False

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.

Expected behavior 2022-08-05 09:17:31,790 cisTarget INFO Done! 2022-08-05 09:17:31,793 pycisTarget_wrapper INFO pbmc_tutorial/motifs/CTX_topics_otsu_No_promoters folder already exists. 2022-08-05 09:17:32,015 pycisTarget_wrapper INFO Running DEM for topics_otsu 2022-08-05 09:17:32,017 DEM INFO Reading DEM database

Version (please complete the following information):

  • Python: [e.g. Python 3.9.12]
  • SCENIC+: [e.g. 0.1.dev40+g4ff5053.d20210520]

Chrisdoan9 avatar Oct 25 '23 21:10 Chrisdoan9

Hi @Chrisdoan9

What is your matplotlib version?

All the best,

Seppe

SeppeDeWinter avatar Oct 31 '23 08:10 SeppeDeWinter

Hi @SeppeDeWinter, it is 3.6.0. Thank you!

import matplotlib
matplotlib.__version__

Would you please have a look at this error which is more important? https://github.com/aertslab/scenicplus/issues/252

Chrisdoan9 avatar Oct 31 '23 17:10 Chrisdoan9

Hello, I'm facing the same problem and my matplotlib version is 3.8.0. Thanks.

JuanruMaryGuo avatar Nov 06 '23 20:11 JuanruMaryGuo

Hi @JuanruMaryGuo. Have you run this cell? I have an error.

from scenicplus.wrappers.run_pycistarget import run_pycistarget
run_pycistarget(
    region_sets = region_sets,
    species = 'homo_sapiens',
    save_path = os.path.join(work_dir, 'motifs'),
    ctx_db_path = rankings_db,
    dem_db_path = scores_db,
    path_to_motif_annotations = motif_annotation,
    run_without_promoters = True,
    n_cpu = 8,
    _temp_dir = os.path.join(tmp_dir, 'ray_spill'),
    annotation_version = 'v10nr_clust',
    )

Chrisdoan9 avatar Nov 06 '23 20:11 Chrisdoan9