Interactive matplotlib?

Matplotlib has some interactive functionality – it is possible to integrate this into a streamlit app?

eg: https://matplotlib.org/3.1.1/users/event_handling.html

Wow, I’m amazed, I did not know this existed :grinning: !

Unfortunately, under the hood for st.pyplot(fig) , fig.savefig(image, **kwargs) is called so Streamlit outputs a static version of the Matplotlib graph.

It’s a bit similar to the Streamlit with OpenAI gym question, keeping the interactivity would mean Streamlit needs to capture Matplotlib’s window and display it, which is not possible through the current API. I wonder if we could get this functionality by somewhat using fig.show() instead but given how Streamlit works internally there would be a lot of work to do for this :confused:

1 Like