title: Python - PyQt Matplotlib plot positioning
body: <p>I am currently making a GUI where I want to have some sliders, some buttons and some plots. I am struggling to position the Matplotlib plot where I want it. The plot is in a QVBoxLayout and I have tried putting this inside a Widget without success. I want to be able to choose the position and size of the plot</p>
  
  <p>Here is what I have now:</p>
  
  <p><a href="http://i.stack.imgur.com/W3bvQ.png" rel="nofollow">Current plot</a></p>
  
  <p>And here is what I want, where I can define position and size so I have space for the other controls:</p>
  
  <p><a href="http://i.stack.imgur.com/6gisE.png" rel="nofollow">What I am looking for, where I can define position and size</a></p>
  
  <p>Here is basic code:</p>
  
  <pre><code>import sys
  import numpy as np
  from PyQt4 import QtGui, QtCore
  # import inspect
  from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
  from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
  import matplotlib.pyplot as plt
  
  class Example(QtGui.QWidget):
  
      def __init__(self):
          super(Example, self).__init__()
  
          self.initUI()
  
      def initUI(self):
  
          #PLOTTING
          self.figure = plt.figure()
          self.canvas = FigureCanvas(self.figure)
          self.toolbar = NavigationToolbar(self.canvas, self)
          self.plot()
  
          # set the layout
          layout = QtGui.QVBoxLayout()
          layout.addWidget(self.toolbar)
          layout.addWidget(self.canvas)
          self.setLayout(layout)
  
          #WINDOW PROPERTIES
          self.resize(800,800)
          self.setWindowTitle('Waveguide Array')
          self.setWindowIcon(QtGui.QIcon('flavicon.png'))
          self.show()
  
      def plot(self):
          ''' plot some random stuff '''
          data = [np.random.random() for i in range(10)]
          ax = self.figure.add_subplot(111)
          ax.hold(False)
          ax.plot(data, '*-')
          self.canvas.draw()
  
      # def update_plot(self):
  
  def main():
  
      app = QtGui.QApplication(sys.argv)
      ex = Example()
      sys.exit(app.exec_())
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>Thanks for the help!</p>