Hello dear Python comunity developper, I would like to know if there is a way to have different callback for every subplot2grid (matplotlib), For example: For the first subplot2grid I want to execute a function which is different from the second subplot2grid that generates executes another function.
I specify that i'm using subplot2grid and not subplot in matplotlib. Thank you,
If your goal is to use a
widget.Button
for each subplot, then the situation is very easy. To create a button you need to pass it anAxes
instance and the button will occupy that space. So you need to create as many new axes as you have subplots, and specify their coordinates appropriately. Then create your buttons, which can have different callback functions.for example:
documentation for
widget.Button
: http://matplotlib.org/api/widgets_api.html#matplotlib.widgets.Buttonexample of implementation: http://matplotlib.org/examples/widgets/buttons.html