title: Python: Plot step function for true/false signals
body: <p>I have a Python dictionary containing for each variable a tuple with an array of points in time and an array of numbers (1/0) representing the Boolean values that the variable holds at a certain point in time. For example:</p>
  
  <pre><code>dictionary["a"] = ([0,1,3], [1,1,0])
  </code></pre>
  
  <p>means that the variable <code>"a"</code> is true at both point in time 0 and 1, at point in time 2 <code>"a"</code> holds an arbitrary value and at point in time 3 it is false.</p>
  
  <p>I would like to generate a plot using <code>matplotlib.pyplot</code> that will look somehow like this:
  <a href="https://i.stack.imgur.com/JZjya.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JZjya.jpg" alt="enter image description here"></a>
  I already tried something like:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  plt.figure(1)
  graphcount = 1
  for x in dictionary:
      plt.subplot(len(dictionary), 1, graphcount)
      plt.step(dictionary[x][0], dictionary[x][1])
      plt.xlabel("time")
      plt.ylabel(x)
      graphcount += 1
  plt.show()
  </code></pre>
  
  <p>but it does not give me the right results. For example, if <code>dictionary["a"] = ([2], [1])</code> no line is shown at all. Can someone please point me in the right direction on how to do this? Thank you!</p>