gpt4 book ai didi

python - 如何用 python-seaborn 保存完整的图形?

转载 作者:太空宇宙 更新时间:2023-11-03 14:08:06 24 4
gpt4 key购买 nike

我用 seaborn 制作了一个热图,它在 ipython notebook 中看起来如下所示: enter image description here

但是当我尝试通过以下方式保存它时:

fig = plt.get_figure()
fig.savefig('heatmap.png')

只保存了部分图形,y轴的一些标签丢失了: enter image description here

你能告诉我如何保存整个数字吗?提前致谢!

最佳答案

试试 fig.savefig('heartmap.png',bbox_inches='tight')

关于python - 如何用 python-seaborn 保存完整的图形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41763686/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com