【发布时间】:2021-01-13 16:01:11
【问题描述】:
我在 pyqtgraph 中绘制 2D 图,当我将图导出为图像时,它正在保存低质量的图像。那么pyqtgraph中是否有任何选项可以通过更改DPI值来保存高质量的绘图图像。
import pyqtgraph as pg
import pyqtgraph.exporters
import numpy as np
x= [10,15,20,25,30,35]
y= [11.142,9.6651,9.4700,9.7334,9.0865,9.1769]
x1= [10,15,20,25,30,35]
y1= [11.1032,9.6214,8.8619,9.0126,8.2405,8.4704]
plt = pg.plot()
plt.showGrid(x=True,y=True)
plt.addLegend()
plt.setBackground('w')
styles = {"color": "#000000", "font-size": "20px"}
plt.setLabel('left', 'Y axis', **styles)
plt.setLabel('bottom', 'X axis',**styles)
plt.setTitle("Graph",fontweight='bold',color='k', size="20pt")
plt.setXRange(10,40)
plt.setYRange(5,25)
plt.setWindowTitle('pyqtgraph plot')
c1 = plt.plot(x, y, pen='b', symbol='o', symbolPen='b', symbolBrush=('b'), name="blue")
c2 = plt.plot(x1, y1, pen='r', symbol='t', symbolPen='r', symbolBrush=('r'), name="red")
if __name__ == '__main__':
import sys
if sys.flags.interactive != 1 or not hasattr(pg.QtCore, 'PYQT_VERSION'):
pg.QtGui.QApplication.exec_()
【问题讨论】:
-
krishna kakade 写道,Answer 说“查看此链接以获取详细解决方案pyqtgraph.readthedocs.io/en/latest/exporting.html”
标签: python plot graph dpi pyqtgraph