如何使用matplotlib教程练习中的matplotlib绘制正弦波

时间:2016-02-13 13:04:45

标签: python matplotlib

import numpy as np
import matplotlib.pyplot as plt

# Try to reproduce the figure shown in images/exercise_1-1.png

# Our data...
x = np.linspace(1, 10, 99)
y1, y2, y3 = np.cos(x), np.cos(x + 1), np.cos(x + 2)
names = ['Signal 1', 'Signal 2', 'Signal 3']
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([x], [y1], color='lightblue', linewidth=3)
plt.show()

我已经尝试了所有可能的方式,但它不会显示。有人得到小费吗?

输出:

enter image description here

0 个答案:

没有答案