Python GUI advice

mhisted's Avatar

mhisted

25 Jan, 2021 07:01 PM

Hi Chris,
I'm adding some Python plotting to our experiments through the client Python Bridge. What do you think is the best way to make plots these days? My plan was to update the plot at the end of each trial, and use matplotlib and the Qt5 backend to display the figure. Are there better web-based backends, or do you have other best-practice approaches to suggest?
thanks,
Mark

  1. Support Staff 1 Posted by Christopher Sta... on 25 Jan, 2021 07:44 PM

    Christopher Stawarz's Avatar

    Hi Mark,

    I don't do a lot of plotting, so I'm probably not the best person to ask. However, if you want to see how I currently make plots using the Python Script Bridge, have a look at

    https://github.com/dicarlolab-mworks/python_bridge_plotting_demo

    I always use matplotlib's default Mac backend ("MacOSX"). This allows my Conduit class to use a combination of pyplot.show() and self._stop_main_loop() to keep the plot window responsive whenever it's waiting for events (which is most of the time). The Conduit class is meant to be reusable, so you should be able to just pull out conduit.py and use it with your own plotting code.

    If you need more info, please let me know.

    Cheers,
    Chris

  2. 2 Posted by mhisted on 26 Jan, 2021 04:17 AM

    mhisted's Avatar

    Thanks, Chris.
    The demo is very helpful.

    I did a little testing with the Qt5Agg backend, and it appears to be fast enough for what I need. There, you can hook an update event into the Qt5 main loop.

    If you hear of anyone doing bridge plotting with fancier methods, including things like mpld3 (D3 for python) or other browser-frontend plotting, please let me know.

    Mark

  3. Christopher Stawarz closed this discussion on 26 Jan, 2021 02:20 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac