用高分辨率图像保存绘图

Roo*_*opa 6 python matplotlib

因为,我是 python 的新手。我试图通过命令在 python 中使用matplotlib保存绘图plt.savefig()。问题是要保存的图像分辨率低。无法读取数据点。

我想知道是否有办法以非常高的分辨率保存这些数字?

Vas*_*ych 6

You can use savfig() to export to an image file with specification of the dpi:

import matplotlib.pyplot as plt
...
plt.savefig('plot_name.png', dpi = 300)
Run Code Online (Sandbox Code Playgroud)

You can choose needed dpi by yourself. I hope it will be useful for you.


Eam*_*nny 5

使用使用特定大小的分辨率大:

 fig = plt.figure(figsize=(19.20,10.80))
Run Code Online (Sandbox Code Playgroud)

例如产生 1080p,你可以比这高得多。