【发布时间】:2016-02-23 13:55:33
【问题描述】:
我有一个在 0 和 1 之间交替的值列表,例如 [0,1,0,1,0],我想用 matplotlib for python 将它们绘制成方波。到目前为止我有这个:
input_amp = [1,0,1,0,1,0,1,0,1,0]
plt.plot(input_amp, marker='d', color='blue')
plt.title("Waveform")
plt.ylabel('Amplitude')
plt.xlabel("Time")
plt.savefig("waveform.png")
plt.show()
这给了我这样的输出 :
我该如何做到这一点,而不是在直线保持平坦的点之间形成一个角度?
我找到了这个post,但它更多地处理动画,而不仅仅是绘制函数。
【问题讨论】:
标签: python matplotlib graphing