Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cutoff of cells in scatter plots when specifying custom figsize #766

Open
WeilerP opened this issue Dec 2, 2021 · 5 comments
Open

Cutoff of cells in scatter plots when specifying custom figsize #766

WeilerP opened this issue Dec 2, 2021 · 5 comments
Labels
bug Something isn't working plotting Plotting-related

Comments

@WeilerP
Copy link
Member

WeilerP commented Dec 2, 2021

When plotting the latent space, for example the velocity stream embedding, with specifying figsize can lead to cells being cut off at the border (see picture below).

image

import scvelo as scv

scv.settings.verbosity = 3
scv.settings.presenter_view = True
scv.settings.set_figure_params('scvelo')

adata = scv.datasets.pancreas()

scv.pp.filter_and_normalize(adata, min_shared_counts=20, n_top_genes=2000)
scv.pp.moments(adata, n_pcs=30, n_neighbors=30)

scv.tl.velocity(adata, mode='deterministic')
scv.tl.velocity_graph(adata)

scv.pl.velocity_embedding_stream(
    adata, legend_loc="right", basis='umap', fontsize=20, dpi=300, figsize=[4,4]
)
Versions
scvelo==0.2.4  scanpy==1.8.2  anndata==0.7.8  loompy==3.0.6  numpy==1.20.3  scipy==1.7.3  matplotlib==3.5.0  sklearn==1.0.1  pandas==1.3.4
@WeilerP WeilerP added the bug Something isn't working label Dec 2, 2021
@WeilerP WeilerP changed the title Cutoff of cells in scatter plots Cutoff of cells in scatter plots when specifying custom figsize Dec 2, 2021
@WeilerP WeilerP added the plotting Plotting-related label Dec 2, 2021
@WeilerP
Copy link
Member Author

WeilerP commented Dec 2, 2021

@seigfried, I managed to reproduce the issue reported in #765 using the Pancreas dataset with figsize=[4, 4]. I suspect you can fix the issue by using a different figure size.

@seigfried
Copy link

@WeilerP It works with smaller figsizes so I will stick to those for now. Thanks for your help

@hyjforesight
Copy link

Hello @WeilerP,
We have the same issue. Is it possible to remove the limit of figsize? I mean, no matter what the value of figsize, it can generate the plot without cutting off at the border?
Thanks!
Best,
YJ

@WeilerP
Copy link
Member Author

WeilerP commented Dec 20, 2021

@hyjforesight, there is always a figure size set. This is a standard matplotlib argument/workflow.

@esfandyari
Copy link

@hyjforesight @WeilerP it's been a while, but in case someone is facing the same problem: for me, using a different figsize didn't solve the problem, but adding the parameter add_margin=0.2 did the trick (scv v0.2.5, matplotlib v3.5.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plotting Plotting-related
Projects
None yet
Development

No branches or pull requests

4 participants