title: Plotting amplitude for thousands of frames
body: <p>I have a time line consisting of thousands of frames (10000 in average).</p>
  
  <p>I have signals occuring during these frames that have amplitude and duration.
  for example:</p>
  
  <blockquote>
    <p>00 11 000 555 000 8888 00 111 0000 2222</p>
  </blockquote>
  
  <p>(the spaces just to show the different signals)</p>
  
  <p>I want to plot the amplitude information over all the frames as bars to see the distribution of the non zero signals and I want the width of these bars to be equal to the number of frames of the represented signal</p>
  
  <h2>Example output for the previous input</h2>
  
  <p><a href="https://i.stack.imgur.com/IBZ6O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IBZ6O.png" alt="enter image description here"></a></p>
  
  <p>I tried <a href="http://matplotlib.org/examples/api/barchart_demo.html" rel="nofollow noreferrer">this</a>, but I couldn't represent the duration of the signal by editing the width of the column.
  Also, it takes around a minute to plot and the zooming is really slow because of the nig number of frames.</p>
  
  <h2>This is my code:</h2>
  
  <pre><code>def show_all_full_time_lines(signals, frames):
      signals_amplitudes = [0]*len(frames)
      times = [frame.time for frame in frames]
  
      for signal in signals:
          start_time_index = times.index(signal.start_time)
          signals_amplitudes[start_time_index] = signal.total_distance
  
      ind = np.arange(len(frames))
      width = 0.35
  
      fig, ax = plt.subplots()
      rects1 = ax.bar(ind, signals_amplitudes, width, color='r')
      ax.set_ylabel('Amplitude')
      ax.set_xticks(ind + width)
      ax.set_xticklabels(times)
      plt.show()
  </code></pre>
  
  <p>which results after a minute of rendering:</p>
  
  <p><a href="https://i.stack.imgur.com/b4PSU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b4PSU.png" alt="enter image description here"></a></p>
  
  <p>(No width for the columns that represents the duration of each signal) and it is very slow.</p>
  
  <p>Thank you very much</p>