title: How to plot square function with matplotlib
body: <p>I have an list of values that alternate between 0 and 1, eg [0,1,0,1,0] and I want to graph them so they appear as a square wave using matplotlib for python. I have this so far:</p>
  
  <pre><code>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()
  </code></pre>
  
  <p>This gives me an output like this <img src="https://i.imgur.com/ppyGobq.png?1" alt="this">:</p>
  
  <p>How do I make it so instead of going on an angle between the points the line stays flat?</p>
  
  <p>I found this <a href="https://stackoverflow.com/questions/28567520/how-do-you-generate-an-animated-square-wave-from-binary-number-for-the-respectiv">post</a> but it deals more with an animation and not just plotting the function.</p>