Starlitnightly/omicverse

KeyError: 'None is not a known colormap name'

Closed this issue · 1 comments

When I used :
ov.utils.embedding(ddata,
basis='X_spatial',
color="major_celltype",
title='Marker Cell types',
palette=ov.palette()[:],wspace=0.55,
show=False,frameon='small',)
I got the error :
KeyError Traceback (most recent call last)
Cell In[123], line 1
----> 1 ov.utils.embedding(ddata,
2 basis='X_spatial',
3 color="major_celltype",
4 title='Marker Cell types',
5 palette=ov.palette()[:],wspace=0.55,
6 show=False,frameon='small',)
File ./Reference/software/envs/omicverse/lib/python3.8/site-packages/omicverse/utils/_scatterplot.py:163, in embedding(adata, basis, color, gene_symbols, use_raw, sort_order, edges, edges_width, edges_color, neighbors_key, arrows, arrows_kwds, groups, components, dimensions, layer, projection, scale_factor, color_map, cmap, palette, na_color, na_in_legend, size, frameon, legend_fontsize, legend_fontweight, legend_loc, legend_fontoutline, colorbar_loc, vmax, vmin, vcenter, norm, add_outline, outline_width, outline_color, ncols, hspace, wspace, title, show, save, ax, return_fig, marker, **kwargs)
161 cmap.set_bad(na_color)
162 else:
--> 163 cmap = copy(matplotlib.colormaps[cmap])
164 cmap.set_bad(na_color)
167 kwargs["cmap"] = cmap

File ./Reference/software/envs/omicverse/lib/python3.8/site-packages/matplotlib/cm.py:82, in ColormapRegistry.getitem(self, item)
80 return self._cmaps[item].copy()
81 except KeyError:
---> 82 raise KeyError(f"{item!r} is not a known colormap name") from None

KeyError: 'None is not a known colormap name'

My data structure is :
AnnData object with n_obs × n_vars = 29820 × 31710
obs: 'area', 'n_genes_by_counts', 'total_counts', 'total_counts_mt', 'pct_counts_mt', 'total_counts_ribo', 'pct_counts_ribo', 'Size_Factor', 'initial_cell_size', 'louvain', 'scc', 'major_celltype'
var: 'mt', 'ribo', 'n_cells_by_counts', 'mean_counts', 'pct_dropout_by_counts', 'total_counts'
uns: '__type', 'louvain', 'louvain_colors', 'neighbors', 'pp', 'scc', 'scc_colors', 'spatial', 'spatial_neighbors', 'umap_fit', 'major_celltype_colors'
obsm: 'X_pca', 'X_spatial', 'bbox', 'contour', 'spatial', 'X_umap'
layers: 'norm_log1p', 'raw'
obsp: 'connectivities', 'distances', 'spatial_connectivities', 'spatial_distances'

Any thanks will be appreciate !

Hi,

You need to set cmap='Reds' in ov.pl.embedding if your version of matplotlib higher.