我找不到更改我使用 matplotlib GUI 显示绘图的文件的默认 DPI 的方法:
当我使用图标保存图形时,默认设置 DPI。 通常,我使用: 将 matplotlib.pyplot 导入为 plt
plt.savefig(figurename,dpi=1000)
我得到了预期的输出,但我无法从 GUI 中获得保存图形的相同输出。
请您参考如下方法:
如果您使用的是 matplotlib
2.x,那么您 can specify the DPI of the figure when creating the figure并且在通过 UI 保存文件时将使用该 DPI;但是,这也将是它在屏幕上呈现的 DPI。
fig = plt.figure(dpi=1000, figsize=(4,4))
否则,您可以在 rcParams 中为 savefig
设置默认 DPI
mpl.rcParams['savefig.dpi'] = 1000