That turns out to be not so easy, the easiest solution would be to create a new figure and issue the plot command again with the required data. Sharing axes objects across multiple figures is quite difficult.
However, solution below allows you to zoom in on a particular subplot using shift+left click.
def add_subplot_zoom(figure):
zoomed_axes = [None]
def on_click(event):
ax = event.inaxes
if ax is None:
# occurs when a region not in an axis is clicked...
return
# we want to allow other navigation modes as well. Only act in case
# shift was pressed and the correct mouse button was used
if event.key != 'shift' or event.button != 1:
return
if zoomed_axes[0] is None:
# not zoomed so far. Perform zoom
# store the original position of the axes
zoomed_axes[0] = (ax, ax.get_position())
ax.set_position([0.1, 0.1, 0.85, 0.85])
# hide all the other axes...
for axis in event.canvas.figure.axes:
if axis is not ax:
axis.set_visible(False)
else:
# restore the original state
zoomed_axes[0][0].set_position(zoomed_axes[0][1])
zoomed_axes[0] = None
# make other axes visible again
for axis in event.canvas.figure.axes:
axis.set_visible(True)
# redraw to make changes visible.
event.canvas.draw()
figure.canvas.mpl_connect('button_press_event', on_click)
Source. Calling the function in your example as:
import matplotlib.pyplot as plt
f,ax_array=plt.subplots(6,3)
for i in range(0,6):
for j in range(0,3):
ax_array[i][j].plot(modified_data[3*i+j])
add_subplot_zoom(f)
plt.show()