python画图的dpi设置

https://stackoverflow.com/questions/47633546/relationship-between-dpi-and-figure-size

import numpy as np
import matplotlib.pyplot as plt
x=np.linspace(-2,2)
y=np.sin(x)
plt.figure(figsize=(10,8),dpi=50)
plt.plot(x,y)
plt.savefig("./1.png")
plt.show()
plt.figure(figsize=(5,7))
plt.plot(x,y)
plt.savefig("./2.png")
plt.show()

你可能感兴趣的:(python,可视化,python,机器学习)