I am plotting graph 2D plot in pyqtgraph, and when I am exporting the plot as an image it is saving a low-quality image. so is there any option in pyqtgraph to save high-quality image of the plot like by changing the DPI value.
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_()
I am exporting the plot by right-clicking on the plot and then clicking on export option.
The exact set of image formats supported will depend on your Qt libraries but for getting more detailed solution how to export images in a good format without affecting a height/pixels parameter check this link for a detailed explanation https://www.xspdf.com/resolution/52389032.html