sc.pl.scatter for var
See original GitHub issueI get the following error when trying to use sc.pl.scatter to plot gene expression, with use_raw=False. I am using sc.pl.scatter instead of sc.pl.umap, .tsne, etc., because of the need to use custom basis names.
File "/opt/Python/3.6.5/lib/python3.6/site-packages/scanpy/plotting/_anndata.py", line 118, in scatter
ax=ax)
File "/opt/Python/3.6.5/lib/python3.6/site-packages/scanpy/plotting/_anndata.py", line 390, in _scatter_obs
c = adata.raw.obs_vector(key, layer=layers[2])
TypeError: obs_vector() got an unexpected keyword argument 'layer'
The following snippet is copied from _scatter_obs()
in /scanpy/plotting/_anndata.py
# coloring according to gene expression
elif (use_raw
and adata.raw is not None
and key in adata.raw.var_names):
c = adata.raw.obs_vector(key)
elif key in adata.var_names:
c = adata.raw.obs_vector(key, layer=layers[2])
Should line 390 be c = adata.obs_vector(key, layer=layers[2]) since it is handling the case when use_raw==False and adata.raw.obs_vector does not take layer as argument.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
scanpy.pl.scatter — Scanpy 1.9.1 documentation
Scatter plot along observations or variables axes. Color the plot using annotations of observations ( .obs ), variables ( .var ) or expression...
Read more >sc.pl.scatter for var · Issue #762 · scverse/scanpy - GitHub
I get the following error when trying to use sc.pl.scatter to plot gene expression, with use_raw=False. I am using sc.pl.scatter instead of sc....
Read more >graph twoway scatter - Title Syntax
graph twoway scatter — Twoway scatterplots marker label options. Description mlabel(varlist) specify marker variables mlabposition(clockposlist).
Read more >seaborn.scatterplot — seaborn 0.12.1 documentation - PyData |
Grouping variable that will produce points with different sizes. Can be either categorical or numeric, although size mapping will behave differently in latter ......
Read more >pbmc10k - Pitt CRC
View of AnnData object with n_obs × n_vars = 11692 × 33538 var: 'gene_ids', ... sc.pl.scatter(adata, x='n_counts', y='percent_mito') sc.pl.scatter(adata, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@coh-racng I would like to add that for your specific intention the best way is to load the
plot_scatter
function that acceptsbasis
as parameter and works well with layers.The code should be:
@ivirshup, @falexwolf I think we should add
plot_scatter
to the API maybe renaming itplot_embedding
to help users like @coh-racng. Currently we have two different ways to make scatter plots: One for embeddings (plot_scatter
) and other more generic for obs and vars (sc.pl.scatter
) that acceptsx
andy
parameters.Thanks for the bug report! That sounds totally right, would you mind submitting a PR to fix that?