I have an app where my users are requesting that I smooth the curves connecting points in a line or scatter plot. This is usually an option in spreadsheet charts.
Here's a crude example of plotting a sine function with points every 45 degrees.
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
app = QtGui.QApplication([])
win = pg.GraphicsWindow(title="Basic plotting examples")
win.resize(1000,600)
win.setWindowTitle('pyqtgraph example: Plotting')
# Enable antialiasing for prettier plots
pg.setConfigOptions(antialias=True)
angles = np.radians(np.arange(0,360+45, 45))
p1 = win.addPlot(title="Rough sine wave", y=np.sin(angles), symbolBrush=(255,0,0), symbolPen='w')
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
I'd like it if I could get a smooth curve through the points, like in this plot from LibreOffice:
Is there any way to do this in pyqtgraph? In this example, I can get a smoother curve by just graphing every 1 degree instead of every 45 degrees. However in my real world app, I am downloading data from a GPIB instrument. And it's slow. So if I was to get more points from my instrument, my app would get even laggier than it is now.