def main():
    fig, axes = plt.subplots(nrows=2, ncols=2)
for ax, color in zip(axes.flat, ['r', 'g', 'b', 'c']):
    ax.plot(list(range(10)), color=color)
fig.canvas.mpl_connect('button_press_event', on_click)
plt.show()

def on_click(event):
    """Enlarge or restore the selected axis."""
ax = event.inaxes
if ax is None:
    return
Matplotlib: Grab Single Subplot from Multiple Subplots