How to modify code for GUI-based realtime plotting using matplotlib?

preview_player
Показать описание

Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!How to modify code for GUI-based realtime plotting using matplotlib?

I have a GUI using PySimpleGUI with multiple plots which receives data from a bluetooth device. I'd like to plot the received data in real-time ideally as fast as the points are received. Right now this is about 1 point every 20ms. However, in it's current state, it is agonizingly slow. The hardware is long done with it's measurement before the GUI can catch up. The entire GUI is bogged down and doesn't even register the device has completed its tasks.

class DataPlot:
#english
def update(self, plot_func):
plot_func()

class View:
#english
def update_demo_plots(
self, calibration_sweeps: List[SensorSweep], test_sweeps: List[SensorSweep]
):
def demo_well1_update(calibration_sweeps, test_sweeps):
for c_num in range(8):
cal_x,
cal_y,
"s",
color="blue",
markersize=2,
label="Calibration" if c_num == 0 else None,
)

lambda: demo_well1_update(calibration_sweeps, test_sweeps)
)

#other plotting

class DataPlot:
#english
def update(self, plot_func):
plot_func()

class View:
#english
def update_demo_plots(
self, calibration_sweeps: List[SensorSweep], test_sweeps: List[SensorSweep]
):
def demo_well1_update(calibration_sweeps, test_sweeps):
for c_num in range(8):
cal_x,
cal_y,
"s",
color="blue",
markersize=2,
label="Calibration" if c_num == 0 else None,
)

lambda: demo_well1_update(calibration_sweeps, test_sweeps)
)

#other plotting

Every time a point is received, update_demo_plots() is called. This completely clears and replots all data for every point.

Tags: python,matplotlib,plot,pysimpleguiSource of the question:

Question and source license information:
Рекомендации по теме
join shbcf.ru