title: Embed a pyqtgraph plot into a QT .ui?
body: <p>first of all I hope you have me some patience since I'm new on these kind of projects and I also hope not to be asking dumb questions. That being said, my main objective is to create a UI for a raspberry pi 3 which will sense voltage, current, etc from a battery and from a solar panel. </p>
  
  <p>Since I'm working on a raspberry and have some knowledge on Python3, I decided to use QTCreator which as I understand can be translated into python3 through pyqt (<a href="https://nikolak.com/pyqt-qt-designer-getting-started/" rel="nofollow noreferrer">https://nikolak.com/pyqt-qt-designer-getting-started/</a>). I installed it on my raspberry pi and made the following UI:</p>
  
  <p>after having a basic UI, I converted the .ui file into .py with the pyuic5 command and I'm able to open the UI with "python3 main.py" and everything seems right:</p>
  
  <p>how the UI looks after opening the main.py file</p>
  
  <p><img src="https://i.stack.imgur.com/HUGdj.png" alt=""> </p>
  
  <p>Now, I want to have a several plots (like voltage against time, etc) on the UI. I'm using the following for testing:</p>
  
  <pre><code>import sys
  import pyqtgraph as pg
  from pyqtgraph.Qt import QtCore, QtGui
  import numpy as np
  
  pg.setConfigOption('background', 'w')
  pg.setConfigOption('foreground', 'k')
  win = pg.GraphicsWindow()
  win.setWindowTitle('pyqtgraph example: Scrolling Plots')
  
  
  p1 = win.addPlot(labels =  {'left':'Voltage', 'bottom':'Time'})
  data1 = np.random.normal(size=10)
  data2 = np.random.normal(size=10)
  curve1 = p1.plot(data1, pen=(3,3))
  curve2 = p1.plot(data2, pen=(2,3))
  ptr1 = 0
  
  def update1():
      global data1, curve1, data2, ptr1
  
      data1[:-1] = data1[1:]  # shift data in the array one sample left
                              # (see also: np.roll)
      data1[-1] = np.random.normal()
      ptr1 += 1
  
      curve1.setData(data1)
      curve1.setPos(ptr1,0)
  
  
  
      data2[:-1] = data2[1:]  # shift data in the array one sample left
                              # (see also: np.roll)
      data2[-1] = np.random.normal()
      curve2.setData(data2)
      curve2.setPos(ptr1,0)
  
  
  def update():
      update1()
  
  timer = pg.QtCore.QTimer()
  timer.timeout.connect(update)
  timer.start(2000) # number of seconds (every 1000) for next update
  
  
  
  if __name__ == '__main__':
      QtGui.QApplication.instance().exec_()
  </code></pre>
  
  <p>Is it possible to embbed that plot into my main.py file? If I understood correctly, I'm supposed to use the promoting widget functionality on QTCreator. Thanks in advance guys!</p>