1、正弦和余弦的图形
import numpy as np from matplotlib import pyplot as plt %matplotlib notebook x = np.linspace((-np.pi)*2, np.pi*2, 50, endpoint=True) y1, y2 = np.sin(x), np.cos(x) plt.plot(x, y1, c='g', marker='s', label='sin(x)') plt.plot(x, y2, c='r', marker='o', label='con(x)') plt.legend(loc='upper left', numpoints=2,)
2、反正弦和反余弦的图形
import numpy as np from matplotlib import pyplot as plt %matplotlib notebook x = np.linspace(-4, 4, 100) y1, y2 = np.arcsin(x), np.arccos(x) plt.plot(x, y1, c='b', marker='s', label='arcsin(x)') plt.plot(x, y2, c='r', marker='o', label='arccon(x)') plt.legend(loc='upper right', numpoints=2,) plt.ylim(-4, 4)