[go: nahoru, domu]

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

plots in Rstudio messed up #2955

Closed
2 of 3 tasks
Sirin24 opened this issue Mar 25, 2024 · 3 comments
Closed
2 of 3 tasks

plots in Rstudio messed up #2955

Sirin24 opened this issue Mar 25, 2024 · 3 comments

Comments

@Sirin24
Copy link
Sirin24 commented Mar 25, 2024

Please make sure these conditions are met

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the main branch of scanpy.

What happened?

I am using Rstudio as the only means available by my institution through slurm to do single cell analysis. and the plots using scanpy are messed up. i tried different parameters. I am not sure if this issue is related to rstudio or i am doing something wrong.

Minimal code sample

sc.pl.umap(
    sample,
    color=["supercluster_term"],
    legend_loc="right margin",  # or choose the location you prefer
    legend_fontsize=5,     # Adjust font size if needed
    frameon=True,
    title=["Provided cell type"],
)

Error output

No response

Versions


anndata 0.10.5.post1
scanpy 1.9.8

PIL 10.2.0
absl NA
array_api_compat 1.4.1
attr 23.2.0
chex 0.1.85
contextlib2 NA
cycler 0.12.1
cython_runtime NA
dateutil 2.9.0.post0
docrep 0.3.2
etils 1.5.2
exceptiongroup 1.2.0
flax 0.8.1
fsspec 2024.2.0
h5py 3.10.0
igraph 0.10.8
importlib_resources NA
jax 0.4.25
jaxlib 0.4.25
jinja2 3.1.3
joblib 1.3.2
kiwisolver 1.4.5
leidenalg 0.10.2
lightning 2.1.4
lightning_utilities 0.10.1
llvmlite 0.42.0
louvain 0.8.1
markupsafe 2.1.5
matplotlib 3.8.3
ml_collections NA
ml_dtypes 0.3.2
mpl_toolkits NA
mpmath 1.3.0
msgpack 1.0.8
mudata 0.2.3
multipledispatch 0.6.0
natsort 8.4.0
numba 0.59.0
numpy 1.26.4
numpyro 0.14.0
opt_einsum v3.3.0
optax 0.2.1
packaging 23.2
pandas 2.2.1
pkg_resources NA
pygments 2.17.2
pynndescent 0.5.11
pyparsing 3.1.2
pyro 1.9.0
pytz 2024.1
rich NA
rpycall NA
rpytools NA
scipy 1.12.0
scvi 1.1.2
session_info 1.0.0
six 1.16.0
sklearn 1.4.1.post1
skmisc 0.3.1
sympy 1.12
texttable 1.7.0
threadpoolctl 3.3.0
toolz 0.12.1
torch 2.2.1+cu121
torchgen NA
torchmetrics 1.3.1
tqdm 4.66.2
typing_extensions NA
umap 0.5.5
yaml 6.0.1
zipp NA
zoneinfo NA

Python 3.9.18 (main, Jan 4 2024, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)]
Linux-5.14.0-162.23.1.el9_1.x86_64-x86_64-with-glibc2.34

Session information updated at 2024-03-25 15:35
Screenshot 2024-03-25 at 2 29 35 PM
Screenshot 2024-03-14 at 10 16 46 PM
Screenshot 2024-03-22 at 2 14 30 AM

@Sirin24 Sirin24 changed the title Rstudio and plots messed up plots in Rstudio messed up Mar 25, 2024
@ivirshup
Copy link
Member

I'm not sure I can help a lot, but I strongly suspect this is weird interactions between matplotlib and rstudio.

First thing I would suggest is increasing your figure size a bit. Either through scanpy's set_figure_params(figsize=...) or via matplotlib directly with rcParams (here's a temporary link to a demonstration of this, but it will be on the main docs shortly)

I've seen things like this before when matplotlib was using one of its less supported backends. You can check which backend is being used with:

import matplotlib as mpl
mpl.get_backend()

I think agg is the safest choice for backend, you can choose it with:

mpl.use("agg")

@lazappi any thoughts/ experience on your end?

@lazappi
Copy link
Contributor
lazappi commented Mar 26, 2024

Not really, sorry. I haven't tried Python plotting through RStudio much but I vaguely remember seeing similar issues (and it's probably not a scanpy specific thing. I agree it looks like a size/scaling problem so those sound look good suggestions. It would be more messing around but you could also try saving plots as a file and opening that in RStudio. Maybe the internet as more general RStudio/Python plotting advice?

@ivirshup
Copy link
Member
ivirshup commented Apr 3, 2024

@Sirin24, I don't think I would consider this a bug in scanpy given the current info. I would suggest asking about this on https://discourse.scverse.org or a reticulate discussion forum.

I am happy to reopen if this is specific to scanpy and doesn't also occur if you're using seaborn or matplotlib on their own.

@ivirshup ivirshup closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants