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)

plt.subplot(2, 1, 1)
plt.plot(t1, np.cos(t1), 'bo', label='Cosinus')
plt.plot(t2, np.sin(t2), 'k-', label='Sinus')
plt.legend(loc='upper right')
plt.grid(True)
plt.title('Subplots')
plt.ylabel('Cosinus und Sinus')

plt.subplot(2, 1, 2)
plt.plot(t3, np.cos(10 * t3), 'r-')
plt.grid(True)
plt.xlabel('Zeit (s)')
plt.ylabel('Cosinus mit\n 10-facher Frequenz', multialignment='right')

plt.show()
