Skip to content

Changing scanpy.pl.dotplot to return the matplotlib figure instead of GridSpec - #1069

Closed
atarashansky wants to merge 3 commits into
scverse:masterfrom
atarashansky:dotplot
Closed

atarashansky wants to merge 3 commits into
scverse:masterfrom
atarashansky:dotplot

Conversation

@atarashansky

@atarashansky atarashansky commented Feb 21, 2020 •

Copy link
Copy Markdown

Fixes issue #979

Note that if you wish to modify the figure in the same jupyter notebook cell in which the plotting function is called, you should set show=False:

fig,ax = sc.pl.dotplot(adata,var_names,show=False)
ax.set_xlabel('test')

@flying-sheep flying-sheep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better if this behaved the way all plotting functions behave:

They usually either return a single Axes object (if show=False) or a Figure object if return_fig=True.

@z5ouyang

z5ouyang commented May 6, 2020

Copy link
Copy Markdown

Any updates on this? scanpy=1.4.6 is still not to return matplotlib figure but still GridSpec even with "show=False". Or is there any other way to modify the figure/ax and save it after?
Thanks!

@fidelram

Copy link
Copy Markdown
Collaborator

I am trying to address this and other issues in #1127

In the new implementation, a dictionary of axes is returned.

@olgabot

olgabot commented Jun 15, 2020

Copy link
Copy Markdown

Yes, this would be much appreciated! I'd like to be able to combine dotplots ax objects from multiple different AnnData objects into the same matplotlib.figure object.

@fidelram

Copy link
Copy Markdown
Collaborator

After PR #1210 this is now possible for dotplot, matrixplot and stacked_viloin in master. See here for an example.

Using show=False returns a dictionary of axes and an axis can be passed to the plots.

@fidelram fidelram closed this Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants