我正在使用plt.plot()
从pyplot
绘制FTDI端口的传感器数据。不幸的是,不知什么原因,我没有看到一条线。但是,当我更改mark type:plt.plot(duration, temp, 'o')
(或其他任何类似marktype的点)时,一切都会正常进行。我试图增加睡眠时间(阅读plot
问题和其他类似问题的实时绘图),但事实并非如此
#!/usr/bin/python
import time
import numpy as np
import matplotlib.pyplot as plt
print "We are plotting sonar values"
f = open('/dev/ttyUSB0', 'r')
plt.axis()
plt.ion()
plt.show()
duration = 0;
while True:
print f.readline()
temp = f.readline()
temp = int(temp[1:])
plt.plot(duration, temp, 'o')
duration+=1
plt.draw()
time.sleep(0.1)
目前没有回答
相关问题 更多 >
编程相关推荐