Open jgeisz opened 2 years ago
Or maybe check this library, that apparently does that for different types of plots.
I made the Multi2T plots interactive with controls. Didn't need to use asyncio, just replaced the data in each line after recalculating. These examples helped me better understand matplotlib. Thanks Jero!
Tandem3T plots are also now interactive with controls. Fast fit calculations are performed as controls are changed. Slower fit calculations are only performed when button is pushed. I did not use asyncio yet, but this may help smooth plot changes and prevent making changes during long calculations. Please try it out and let me know if it works for you.
I have been checking how to solve that. I think the best approach is to use async calls[1], as the simulation to do the fitting typically it won't be less than hundred of ms.
This is the code for the notebook
The other option to do it even faster is to use blit to avoid re-draw[2]-[3]. But instead of going that route, what I think it will be better is to encapsulate this on a class or similar for future use.
[1]https://stackoverflow.com/questions/63384326/how-to-update-interactive-figure-in-loop-with-jupyterlab/63517891#63517891 [2] https://stackoverflow.com/questions/40126176/fast-live-plotting-in-matplotlib-pyplot [3]https://matplotlib.org/stable/tutorials/advanced/blitting.html