bluesky / bluesky-widgets

Components for graphical applications that interact with bluesky libraries
http://blueskyproject.io/bluesky-widgets
BSD 3-Clause "New" or "Revised" License
6 stars 22 forks source link

Refine Jupyter--matplotlib--RunEngine interaction #52

Open danielballan opened 3 years ago

danielballan commented 3 years ago

In Jupyter, any figure widgets created during plan execution will display but will not receive data until the cell is done executing. Thereafter, any changes to the figure (e.g. additional plans executed that add lines to a plot) will live-update during cell execution as desired.

It seems we need a way to tell ipywidgets to service the new figure widget.

danielballan commented 3 years ago

We have a workaround in #54, but it hammers figure.canvas.draw() more than it should. I am leaving this open to track any progress on a better solution.

danielballan commented 3 years ago

In #68 we stop hammering draw(), and the reliability seems good. However, we have to constrain ourselves to avoid any methods that require a draw, like fig.tight_layout() or axes.legend(loc="best"). We can relax that constraint by routing the signals through traitlets. This might be straightforward but it would take some time to test it thoroughly, so I'll leave that for a separate PR.