Is it possible to add a title to plots from sc.pl.umap?

The code i am using is below.

sc.pl.umap(
        obj,
        components=['1,2', '1,3', '2,3'],
        color=["leiden","phase"],
        ncols=3,
        wspace=0.45,
    )

I would like to add a title to the resulting plot. If scanpy returned fig or ax objects I would be able to simply add

plt.suptitle("My Title", y=0.99)

and I would have what I want which is something like this example:

Thoughts on how to do this?

Hi @xguse,

You should just be able to use the title parameter in sc.pl.umap(). You can find the documentation for this function here, which has the details of all things you can set.

Also, note that if you set show=False the function should return an axis object.

This is what happens when the title keyword is provided to a multi-panel umap plot:

That keyword is specific to a panel, not the whole figure. That is why I was specifically referencing plt.suptitle rather than plt.title.

However, I believe that your reminder that I need to specifically set show=False is spot on and allows me to use a subsequent call to plt.suptitle to set the super-title.

So thanks for that reminder. I wish I could remember that bit about show=False more consistently.

Ah, yes. I wasn’t sure what it would do for a multi-panel. But glad it works now anyway.

The function documentation should be pretty comprehensive and help with these issues. The show=False return object is stated there as well.

Hello,

Thanks for scanpy! I’m using it on a daily basis.

I tried using title for violin plots but does not show up, is there a way to set title for violinplots?

Thanks!