FastPlot reads a serial input stream and displays a real-time matplotlib animation. You can click the plot to pause updates, or close the window to gracefully terminate both rendering and serial communication threads.
FastPlot assumes each line to be only consisted of numeric variables (label) and delimiters (delim). If not, you can design your own filter to be applied before parsing each line. Wrongly placed delimiters are automatically neglected.
pip install -r requirements.txtimportfastplotasppimportmatplotlib.pyplotasplt# append min max value of y rangef=lambday: y+',0,400'# specify a serial port to readboard=pp.Poller(filter=f)
board.connect('COM7', 115200)
board.start()
# draw a line plot (like a serial plot of Arduino IDE)anim=pp.LinePlotter(
labels=['a', 'b', 'c', 'd', 'min', 'max'], poller=board, rows=30, delim=',').draw(interval=10)
# display plot animationplt.show()importfastplotasppimportmatplotlib.pyplotasplt# specify a serial port to readboard=pp.Poller()
board.connect('COM11', 115200)
board.start()
# draw a bar plot (visualize only the most recent row)anim=pp.BarPlotter(
labels=['r', 'x', 'y', 'z'],
poller=board, delim='\t').draw(interval=10)
# display plot animationplt.show()