import numpy as np import matplotlib.pyplot as plt x = np.arange(-5, 5, 0.1) y = np.sin(x) plt.plot(x, y, "-", label="-") plt.plot(x+0.2, y, "--", label="--") plt.plot(x+0.4, y, "-.", label="-.") plt.plot(x+0.6, y, ":", label=":") plt.legend() plt.xlim(-np.pi, np.pi) plt.savefig("lines.png")