首页 > 解决方案 > matplotlib 中是否有最大的 figsize?

问题描述

我正在尝试保存一张大图片(实际上比我的显示器的分辨率大),但是在增加 figsize 时我得到了相同大小的 png 图片。因此,对于下面的两个示例,我得到完全相同的文件:

import matplotlib.pylab as plt
fig, ax = plt.subplots(nrows=2, ncols=1, figsize=(10, 100))
ax[0].plot([0, 1], [0, 1])
ax[1].plot([0, 1], [0, 1])
fig.savefig('test1.png')
plt.close()

第二:

fig, ax = plt.subplots(nrows=2, ncols=1, figsize=(10, 150))
ax[0].plot([0, 1], [0, 1])
ax[1].plot([0, 1], [0, 1])
fig.savefig('test2.png')
plt.close()

请问有什么办法可以放大图片吗?

标签: pythonmatplotlibpycharm

解决方案


感谢@ImportanceOfBeingErnest,确实问题出在 PyCharm 上。(我用的是2017.2.3)

因此,如果有人遇到同样的问题 - 只需在 PyCharm 之外尝试!


推荐阅读