我想将 1600 个点绘制到 1000 像素宽的图形(仅图形,不计算轴和空格)。这种设置英寸和每英寸像素数 (DPI) 的方法是否是最佳方法?有没有更好的方法?
self.figure, (self.picture, self.intensity) =
plt.subplots(nrows=2, figsize=(10, 5))
self.figure.set_dpi(100)
对于宽 1600 像素、高 1000 像素的图形,您可以执行以下操作:
import matplotlib.pyplot as plt
plt.figure(figsize=(16, 10), dpi=100)
# ... your code
plt.savefig(filename)