title: Real time candlestick chart (matplotlib)
body: <p>I'm trying to plot candlestick chart from <code>matplotlib.finance</code> in real time with data from Interactive Brokers. Does anyone have a simple example that does this? I am able to do it using a simple line plot with something along the lines of</p>
  
  <pre><code>class Data:
      def __init__(self, maxLen=50):
          self.maxLen = maxLen
          self.x_data = np.arange(maxLen)
          self.y_data = deque([], maxLen)
  
      def add(self, val):
          self.y_data.append(val)
  
  class Plot:
      def __init__(self, data):
          plt.ion()
          self.ayline, = plt.plot(data.y_data)
          self.ayline.set_xdata(data.x_data)
  
      def update(self, data):
          self.ayline.set_ydata(data.y_data)
          plt.draw()
  
  if __name__ == "__main__":
      data = Data()
      plot = Plot(data)
  
      while 1:
          data.add(np.random.randn())
          plot.update(data)
          sleep(1)
  </code></pre>
  
  <p>How can I change this to a candlestick chart instead by providing 5-tuples as y-values?</p>