简体   繁体   中英

How to plot several seaborn heatmaps in a single figure?

I have generated a sns heatmap (ClusterGrid object) using scVelo , but how does one fit serval such objects into a single figure in matplotlib?

I've tired many options (and of course attempted any suggestion I could find on StackOverflow:) but nothing seems to work. I can export to png and reload the data, but that reduces the quality of the images.

Any suggestions?

Thanks!

This is not an optimal solution, but this is what I was able to come up with.. saved the images as PNG files and then reload them as subplots

plt.figure(figsize=(30, 15))
plt.suptitle("title", fontsize=22)

plt.subplot(133)
plt.imshow(mpimg.imread('./figures/heatmap_2.png',format="png"))
plt.title("expression")
plt.grid(None) 
plt.axis('off')

plt.subplot(132)
plt.imshow(mpimg.imread('./figures/heatmap_1.png'), format="png"))
plt.grid(None) 
plt.axis('off')

plt.subplot(131)
plt.imshow(mpimg.imread('./figures/3.png',format="png"))
#plt.grid(None) 
plt.grid(None) 
plt.axis('off')

plt.show()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM