grid(True)
title('A tale of 2 subplots')
ylabel('Damped oscillation')
autoAxis = sub1.axis()
rec = Rectangle((autoAxis[0] - 0.7, autoAxis[2] - 0.2), autoAxis[1] -
    autoAxis[0] + 1, autoAxis[3] - autoAxis[2] + 0.4, fill=False, lw=2)
rec = sub1.add_patch(rec)
rec.set_clip_on(False)
subplot(212)
plot(t3, cos(2 * pi * t3), 'r.')
grid(True)
xlabel('time (s)')
ylabel('Undamped')
savefig('test.png')
нарисовать границу вокруг подзаговоров в matplotlib