theislab / scvelo

RNA Velocity generalized through dynamical modeling
https://scvelo.org
BSD 3-Clause "New" or "Revised" License
411 stars 102 forks source link

pl.heatmap error #214

Closed lixin4306ren closed 4 years ago

lixin4306ren commented 4 years ago

Got the following error when running scv.pl.heatmap:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-126-3c65de70701e> in <module>
----> 1 scv.pl.heatmap(adata, var_names=top_genes, sortby='latent_time', col_color='clusters', n_convolve=100)

~/miniconda3/lib/python3.7/site-packages/scvelo/plotting/heatmap.py in heatmap(adata, var_names, sortby, layer, color_map, col_color, palette, n_convolve, standard_scale, sort, colorbar, col_cluster, row_cluster, figsize, font_scale, show, save, **kwargs)
     96 
     97     cm = sns.clustermap(df.T, col_colors=col_color, col_cluster=col_cluster, row_cluster=row_cluster, cmap=color_map,
---> 98                         xticklabels=False, standard_scale=standard_scale, figsize=figsize, **kwargs)
     99 
    100     savefig_or_show('heatmap', save=save, show=show)

~/miniconda3/lib/python3.7/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/lib/python3.7/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/lib/python3.7/site-packages/seaborn/matrix.py in plot_colors(self, xind, yind, **kws)
   1085 
   1086             heatmap(matrix, cmap=cmap, cbar=False, ax=self.ax_col_colors,
-> 1087                     xticklabels=False, yticklabels=col_color_labels, **kws)
   1088 
   1089             # Adjust rotation of labels, place on right side

~/miniconda3/lib/python3.7/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/lib/python3.7/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/lib/python3.7/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/lib/python3.7/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/lib/python3.7/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/lib/python3.7/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/lib/python3.7/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/lib/python3.7/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/lib/python3.7/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'
VolkerBergen commented 4 years ago

Hmm, first time seeing this error. Could you try again with upgrading seaborn pip install -U seaborn

lixin4306ren commented 4 years ago

I upgraded seaborn to seaborn-0.10.1 and the problem solved, thanks.

preetida commented 4 years ago

Hi, I have the exact same issue. I have seabron-0.10.1

top_genes = adata_subset.var['fit_likelihood'].sort_values(ascending=False).index[:300]
scv.pl.heatmap(adata_subset, var_names=top_genes, sortby='latent_time', col_color='Clusters', n_convolve=100)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-34-0c594a8120b1> in <module>
      1 import seaborn
      2 top_genes = adata_subset.var['fit_likelihood'].sort_values(ascending=False).index[:300]
----> 3 scv.pl.heatmap(adata_subset, var_names=top_genes, sortby='latent_time', col_color='Clusters', n_convolve=100)

~/jupytervenv/lib/python3.7/site-packages/scvelo/plotting/heatmap.py in heatmap(adata, var_names, sortby, layer, color_map, col_color, palette, n_convolve, standard_scale, sort, colorbar, col_cluster, row_cluster, figsize, font_scale, show, save, **kwargs)
     96 
     97     cm = sns.clustermap(df.T, col_colors=col_color, col_cluster=col_cluster, row_cluster=row_cluster, cmap=color_map,
---> 98                         xticklabels=False, standard_scale=standard_scale, figsize=figsize, **kwargs)
     99 
    100     savefig_or_show('heatmap', save=save, show=show)

~/jupytervenv/lib/python3.7/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)

~/jupytervenv/lib/python3.7/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

~/jupytervenv/lib/python3.7/site-packages/seaborn/matrix.py in plot_colors(self, xind, yind, **kws)
   1085 
   1086             heatmap(matrix, cmap=cmap, cbar=False, ax=self.ax_col_colors,
-> 1087                     xticklabels=False, yticklabels=col_color_labels, **kws)
   1088 
   1089             # Adjust rotation of labels, place on right side

~/jupytervenv/lib/python3.7/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 

~/jupytervenv/lib/python3.7/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

~/jupytervenv/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
   1808                         "the Matplotlib list!)" % (label_namer, func.__name__),
   1809                         RuntimeWarning, stacklevel=2)
-> 1810             return func(ax, *args, **kwargs)
   1811 
   1812         inner.__doc__ = _add_data_doc(inner.__doc__,

~/jupytervenv/lib/python3.7/site-packages/matplotlib/axes/_axes.py in pcolormesh(self, alpha, norm, cmap, vmin, vmax, shading, antialiased, *args, **kwargs)
   5994         collection = mcoll.QuadMesh(Nx - 1, Ny - 1, coords,
   5995                                     antialiased=antialiased, shading=shading,
-> 5996                                     **kwargs)
   5997         collection.set_alpha(alpha)
   5998         collection.set_array(C)

~/jupytervenv/lib/python3.7/site-packages/matplotlib/collections.py in __init__(self, meshWidth, meshHeight, coordinates, antialiased, shading, **kwargs)
   1811     def __init__(self, meshWidth, meshHeight, coordinates,
   1812                  antialiased=True, shading='flat', **kwargs):
-> 1813         Collection.__init__(self, **kwargs)
   1814         self._meshWidth = meshWidth
   1815         self._meshHeight = meshHeight

~/jupytervenv/lib/python3.7/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)
    164 
    165         self._path_effects = None
--> 166         self.update(kwargs)
    167         self._paths = None
    168 

~/jupytervenv/lib/python3.7/site-packages/matplotlib/artist.py in update(self, props)
    914 
    915         with cbook._setattr_cm(self, eventson=False):
--> 916             ret = [_update_property(self, k, v) for k, v in props.items()]
    917 
    918         if len(ret):

~/jupytervenv/lib/python3.7/site-packages/matplotlib/artist.py in <listcomp>(.0)
    914 
    915         with cbook._setattr_cm(self, eventson=False):
--> 916             ret = [_update_property(self, k, v) for k, v in props.items()]
    917 
    918         if len(ret):

~/jupytervenv/lib/python3.7/site-packages/matplotlib/artist.py in _update_property(self, k, v)
    910                 func = getattr(self, 'set_' + k, None)
    911                 if not callable(func):
--> 912                     raise AttributeError('Unknown property %s' % k)
    913                 return func(v)
    914 

AttributeError: Unknown property dendrogram_ratio