title: plot goes to zero in between
body: <pre><code>import sys
  import serial
  import numpy as np
  import matplotlib.pyplot as plt
  from collections import deque
  
  port = "COM11"
  baud = 9600
  timeout=1
  
  ser = serial.Serial()
  ser.port = port
  ser.baudrate = baud
  ser.timeout = timeout
  
  
  a1 = deque([0.0]*100)
  #ax = plt.axes(xlim=(0, 100), ylim=(0, 1000))
  
  
  
  line, = plt.plot(a1)
  plt.ion()
  plt.ylim([0,1000])
  
  try:
    ser.open()
  except:
    sys.stderr.write("Error opening serial port %s\n" % (ser.portstr) )
    sys.exit(1)
  
  #ser.setRtsCts(0)
  
  while 1:
       # Read from serial port, blocking
       data = ser.read(1)
  
       # If there is more than 1 byte, read the rest
       n = ser.inWaiting()
       data = data + ser.read(n)
       #sys.stdout.write(data)
       print(a1)
  
       a1.appendleft((data))
       datatoplot = a1.pop()
       line.set_ydata(a1)
       plt.draw()
  </code></pre>
  
  <p>I am using msp430f5438a board.If I send the data with a new line between each data then I am not able to plot the data because in python the sometimes data gets printed as 78_9, 7_89,_789 where _ means space so python gives me a error cannot convert string to float. But If I say send the data from uart without any new line between them then I get a nice plot but in the plot after some irregular short intervals the plot goes to zero and then becomes fine again although I checked in hyperterminal I am not receiving any zero values
  My question is:
  Are the two cases I described are related to each other?What can be done to rectify this problem of plot going to zero in between?Because of this I am not getting a smooth wave.
  Thanks</p>