Skip to content Skip to sidebar Skip to footer

Event Connections And Subplots In Matplotlib

I have what seems to be a simple task yet I am not sure how and where to start. What I currently have is a series of subplots displayed on one figure. Now I want to add/connect a

Solution 1:

You should read this tutorial.

Basically you need to define function which takes one arguement event and then attach it to your figure's canvas:

defopen_new_figure(event):
    if event.inaxes isnotNone:
        ax = event.inaxes
        # you now have the axes object for that the user clicked on# you can use ax.children() to figure out which img artist is in this# axes and extract the data from it

cid = fig.canvas.mpl_connect('button_press_event', open_new_figure)

Post a Comment for "Event Connections And Subplots In Matplotlib"