import matplotlib.pyplot as plt
import numpy as np

t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)
t3 = np.arange(0.0, 2.0, 0.01)

fig = plt.figure()


ax1 = fig.add_subplot(2,1,1)

ax1.set_title('Subplots')

ax1.plot(t1, np.cos(t1), 'bo', label='Cosinus')
ax1.plot(t2, np.sin(t2), 'k-', label='Sinus')
ax1.legend(loc='upper right')
ax1.grid(True)
ax1.set_ylabel('Cosinus und Sinus')

ax2 = fig.add_subplot(2,1,2)

ax2.plot(t3, np.cos(10 * t3), 'r-')
ax2.grid(True)
ax2.set_xlabel('Zeit (s)')
ax2.set_ylabel('Cosinus mit\n 10-facher Frequenz', multialignment='right')

plt.show()
