welch-lab / pyliger

Python package for integrating and analyzing multiple single-cell datasets (A Python version of LIGER)
GNU General Public License v3.0
28 stars 5 forks source link

plot_gene for marker genes, return multiple ggplot objects, how to show them in one picture #2

Closed wubaosheng closed 2 years ago

wubaosheng commented 2 years ago

PRF1 = pyliger.plot_gene(ifnb_liger, "ABCA1", axis_labels = ['UMAP 1', 'UMAP 2'], return_plots = True)

for x in PRF1.values():

x.draw(show=True)

print(PRF1) PRF1['human'].draw(show=True) image

Lulu0015 commented 2 years ago

Hi Baosheng,

Currently, we can’t visualize all ggplot objects in one plot using plotnine (ggplot2 in python). The reason is that plotnine uses Matplotlib which doesn’t have a good layout manager to support subplotting. The simplest way to visualize all plots is to save them and examine them individually. You can combine them the way you like and you may refer to this code for saving one ggplot object. Please make sure you do this for all ggplot objects.

gene_plots[idx].save(filename = file_name, height=10, width=10, units = 'in', dpi=500, verbose=False)

Thanks, Lu Lu

wubaosheng commented 2 years ago

thanks