theislab / cellrank

CellRank: dynamics from multi-view single-cell data
https://cellrank.org
BSD 3-Clause "New" or "Revised" License
347 stars 46 forks source link

`clustermap` raises error #112

Closed Marius1311 closed 4 years ago

Marius1311 commented 4 years ago

When I call cr.pl.cluster_fates(adata_t, mode='clustermap', cluster_key='clusters_fine', clusters=clusters)

I get

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-138-8017ed65d544> in <module>
      1 clusters = ['Fev+ Beta', 'Fev+ Alpha', 'Fev+ Pyy','Fev+ Delta', 'Fev+ Epsilon']
----> 2 cr.pl.cluster_fates(adata_t, mode='clustermap', cluster_key='clusters_fine', clusters=clusters)

~/Projects/cellrank/cellrank/plotting/_cluster_fates.py in cluster_fates(adata, cluster_key, clusters, lineages, mode, final, basis, show_cbar, ncols, sharey, save, legend_kwargs, figsize, dpi, **kwargs)
    501         fig = plot_violin_no_cluster_key() if cluster_key is None else plot_violin()
    502     elif mode == "heatmap":
--> 503         fig = plot_heatmap()
    504     else:
    505         raise ValueError(

~/Projects/cellrank/cellrank/plotting/_cluster_fates.py in plot_heatmap()
    374                 ),
    375                 figsize=figsize,
--> 376                 **kwargs,
    377             )
    378             g.ax_heatmap.set_xlabel(cluster_key)

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/seaborn/matrix.py in clustermap(data, pivot_kws, method, metric, z_score, standard_scale, figsize, cbar_kws, row_cluster, col_cluster, row_linkage, col_linkage, row_colors, col_colors, mask, **kwargs)
   1299                         row_cluster=row_cluster, col_cluster=col_cluster,
   1300                         row_linkage=row_linkage, col_linkage=col_linkage,
-> 1301                         **kwargs)

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/seaborn/matrix.py in plot(self, metric, method, colorbar_kws, row_cluster, col_cluster, row_linkage, col_linkage, **kws)
   1136             yind = np.arange(self.data2d.shape[0])
   1137 
-> 1138         self.plot_colors(xind, yind, **kws)
   1139         self.plot_matrix(colorbar_kws, xind, yind, **kws)
   1140         return self

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/seaborn/matrix.py in plot_colors(self, xind, yind, **kws)
   1065 
   1066             heatmap(matrix, cmap=cmap, cbar=False, ax=self.ax_row_colors,
-> 1067                     xticklabels=row_color_labels, yticklabels=False, **kws)
   1068 
   1069             # Adjust rotation of labels

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/seaborn/matrix.py in heatmap(data, vmin, vmax, cmap, center, robust, annot, fmt, annot_kws, linewidths, linecolor, cbar, cbar_kws, cbar_ax, square, xticklabels, yticklabels, mask, ax, **kwargs)
    526     if square:
    527         ax.set_aspect("equal")
--> 528     plotter.plot(ax, cbar_ax, kwargs)
    529     return ax
    530 

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/seaborn/matrix.py in plot(self, ax, cax, kws)
    282         # Draw the heatmap
    283         mesh = ax.pcolormesh(self.plot_data, vmin=self.vmin, vmax=self.vmax,
--> 284                              cmap=self.cmap, **kws)
    285 
    286         # Set the axis limits

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
   1563     def inner(ax, *args, data=None, **kwargs):
   1564         if data is None:
-> 1565             return func(ax, *map(sanitize_sequence, args), **kwargs)
   1566 
   1567         bound = new_sig.bind(ax, *args, **kwargs)

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/matplotlib/axes/_axes.py in pcolormesh(self, alpha, norm, cmap, vmin, vmax, shading, antialiased, *args, **kwargs)
   6105         collection = mcoll.QuadMesh(Nx - 1, Ny - 1, coords,
   6106                                     antialiased=antialiased, shading=shading,
-> 6107                                     **kwargs)
   6108         collection.set_alpha(alpha)
   6109         collection.set_array(C)

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/matplotlib/collections.py in __init__(self, meshWidth, meshHeight, coordinates, antialiased, shading, **kwargs)
   1940     def __init__(self, meshWidth, meshHeight, coordinates,
   1941                  antialiased=True, shading='flat', **kwargs):
-> 1942         Collection.__init__(self, **kwargs)
   1943         self._meshWidth = meshWidth
   1944         self._meshHeight = meshHeight

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/matplotlib/collections.py in __init__(self, edgecolors, facecolors, linewidths, linestyles, capstyle, joinstyle, antialiaseds, offsets, transOffset, norm, cmap, pickradius, hatch, urls, offset_position, zorder, **kwargs)
    162 
    163         self._path_effects = None
--> 164         self.update(kwargs)
    165         self._paths = None
    166 

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/matplotlib/artist.py in update(self, props)
   1004 
   1005         with cbook._setattr_cm(self, eventson=False):
-> 1006             ret = [_update_property(self, k, v) for k, v in props.items()]
   1007 
   1008         if len(ret):

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/matplotlib/artist.py in <listcomp>(.0)
   1004 
   1005         with cbook._setattr_cm(self, eventson=False):
-> 1006             ret = [_update_property(self, k, v) for k, v in props.items()]
   1007 
   1008         if len(ret):

~/miniconda3/envs/cellrank/lib/python3.6/site-packages/matplotlib/artist.py in _update_property(self, k, v)
   1000                 if not callable(func):
   1001                     raise AttributeError('{!r} object has no property {!r}'
-> 1002                                          .format(type(self).__name__, k))
   1003                 return func(v)
   1004 

AttributeError: 'QuadMesh' object has no property 'dendrogram_ratio'

> /Users/marius/miniconda3/envs/cellrank/lib/python3.6/site-packages/matplotlib/artist.py(1002)_update_property()
   1000                 if not callable(func):
   1001                     raise AttributeError('{!r} object has no property {!r}'
-> 1002                                          .format(type(self).__name__, k))
   1003                 return func(v)
   1004 

The same code with mode heatmap worked though.

michalk8 commented 4 years ago

It's not supported for seaborn<0.10.0. I've bumped the requirements to >=0.10.0. That should fix it.

Marius1311 commented 4 years ago

Thanks!