I am trying to make an interactive plot of two variables 'x' and 'y1', and for each value of 'y1' there is a plot of a 'x' vs a third quantity 'y2'. (For anyone interested, I'm building a binary phase diagram. 'x' is composition, 'y1' is temperature, and 'y2' is the Gibbs free energy. I have equations for x vs y2, which is used to calculate y1)
y1 is on the bottom and y2 for several y1s is plotted on the top:
In the attached image, y1 is plotted in the figure on the bottom, and for each y1 there is a x vs y2 curve. I want to recreate this such that the x vs y2 plot is updated based on the position of cursor on the x vs y1 plot. I would have all of these values calculated and stored in an array so I need to be able to select the right data points depending on the temperature.
Is this possible to implement in Python using any commonly available libraries? Can someone point me in the right direction? If this can't be done in Python I am open to trying other tools.
Thanks in advance.

First, let's create a figure with two subplots and plot our first plot:
Then we need to subscribe to a mouse event (
motion_notify_eventin our case for mouse mouvement) on our figure and handle it once it is fired. Let's create the handler first:This handler needs to be called when we detect mouse mouvement (
mouse_notify_event) so set it up before callingplt.show()as such:Now, here is the
update_ax2method:Here is an example pretty close to what you want to have a better idea of how to set things up: https://matplotlib.org/stable/gallery/event_handling/data_browser.html#sphx-glr-gallery-event-handling-data-browser-py