title: Step plot by reading from file
body: <p>I am a newbie to matplotlib. I am trying to plot step function and having some trouble. Right now I am able to read from the file and plot it as shown below. But the graph in the top is not in steps and the one below is not a proper step. I saw examples to plot step function by giving x &amp; y value. I am not sure how to do it by reading from a file though. Can someone help me?</p>
  
  <pre><code>from pylab import plotfile, show, gca
  import matplotlib.pyplot as plt
  import matplotlib.cbook as cbook
  
  fname = cbook.get_sample_data('sample.csv', asfileobj=False)
  
  plotfile(fname, cols=(0,1), delimiter=' ')
  plotfile(fname, cols=(0,2), newfig=False, delimiter=' ')
  plt.show()
  </code></pre>
  
  <hr>
  
  <p>Sample inputs(3 columns):</p>
  
  <pre><code>27023927    3   0
  27023938    2   0
  27023949    3   0
  27023961    2   0
  27023972    3   0
  27023984    2   0
  27023995    3   0
  27024007    2   0
  27024008    2   1
  27024018    3   1
  27024030    2   1
  27024031    2   0
  27024041    3   0
  27024053    2   0
  27024054    2   1
  27024098    2   0
  </code></pre>
  
  <p>Note: I have made the y-axis1 values as 3 &amp; 2 so that this graph can occur in the top and another y-axis2 values 0 &amp; 1 so that it comes in the bottom as shown below</p>
  
  <hr>
  
  <p>Waveform as it looks now
  <img src="https://i.stack.imgur.com/bHKYL.jpg" alt="enter image description here"></p>