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

a suggestion of save parameter in _chromosome_heatmap.py #148

Open
champeil opened this issue Nov 27, 2024 · 2 comments
Open

a suggestion of save parameter in _chromosome_heatmap.py #148

champeil opened this issue Nov 27, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@champeil
Copy link

Description of feature

When I want to save the heatmap with infercnv.pl.chromosome_heatmap, I noticed about I can't not specify the position to save the heatmap. May be the save parameter can be modified to better specify the position to save?

@champeil champeil added the enhancement New feature or request label Nov 27, 2024
@grst
Copy link
Member

grst commented Nov 27, 2024

This is a known issue with scanpy: scverse/scanpy#1508 (comment) (chromosome_heatmap internally calls scanpy.pl.heatmap)

But the following should work:

import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(10, 5))
infercnv.pl.chromosome_heatmap(..., ax=ax)
fig.figsave("/where/ever/heatmap.pdf")

@champeil
Copy link
Author

I tried with the suggestion, but it return error:

  File "infercnv.py", line 66, in <module>
    cnv.pl.chromosome_heatmap(df, groupby="Cluster", dendrogram=True, ax=ax)
  File "singlecell/lib/python3.8/site-packages/infercnvpy/pl/_chromosome_heatmap.py", line 75, in chromosome_heatmap
    return_ax_dic = sc.pl.heatmap(
  File "singlecell/lib/python3.8/site-packages/scanpy/plotting/_anndata.py", line 1177, in heatmap
    im = heatmap_ax.imshow(obs_tidy.values, aspect='auto', norm=norm, **kwds)
TypeError: inner() got multiple values for argument 'ax'

here is my code:

fig, ax = plt.subplots(figsize=(12, 8))
cnv.pl.chromosome_heatmap(df, groupby="Cluster", dendrogram=True, ax=ax)
fig.figsave(args.result_dir+"/"+args.name+"_cnv_pheatmap.pdf")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants