title: plotWidget doesn't display proper labels
body: <p>In my 'UI-pyqtgraph' application, I can't get my labels displayed properly on plots. I tried several different tricks but I obviously missuse the combination plotWidget/pyqtgaph. Can you tell me what is wrong ?</p>
  <p>For example, here is a toy code that shows 2 curves (crosses and dots). Why are my labels 'result number 1' and 'result number 2' not displayed ?</p>
  <pre><code>import numpy as np
  from pyqtgraph.Qt import QtGui, uic
  
  uifilename = 'testUI211014.ui'
  form_class = uic.loadUiType(uifilename)[0]
  
  class MyWindowClass(QtGui.QMainWindow, form_class):
      def __init__(self):
          QtGui.QMainWindow.__init__(self)
          self.setupUi(self)
  
  if __name__ == '__main__':
      app = QtGui.QApplication([])
      win = MyWindowClass()
  
      x = np.arange(10)
      y1 = x**1.5
      y2 = x**2
      win.graphicsView.plot(x,y1, label='result number 1',symbol='x')
      win.graphicsView.plot(x,y2, label='result number 2',symbol='o')
      win.graphicsView.setLabel('bottom', text='x')
      win.graphicsView.setLabel('left', text='y')
      win.show()
  
      app.exec_()
  </code></pre>
  <p>This gives:
  <a href="https://i.stack.imgur.com/hfxmW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hfxmW.png" alt="enter image description here" /></a>
  with no label displayed...</p>
  <p>I would appreciate regular labels, sampled and commented in a readable and reasonable size text, inside a frame, like usual labels. For instance like the matplotlib version:
  <a href="https://i.stack.imgur.com/GhxYE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GhxYE.png" alt="enter image description here" /></a></p>
  <hr />
  <p>I found that if I use 'labelItem' with, for instance, 3 lines inserted just before the 'win.show()':</p>
  <pre><code>import pyqtgraph as pg
  labelValue = pg.LabelItem('result number 1')
  win.graphicsView.addItem(labelValue)
  </code></pre>
  <p>then 'result number 1' appears, but huge, upside down, unframed and not sampled. Like that:
  <a href="https://i.stack.imgur.com/2nXWV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2nXWV.png" alt="enter image description here" /></a></p>
  <hr />
  <p>the file 'testUI211014.ui' is just a plotWidget in a mainWindow:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;ui version=&quot;4.0&quot;&gt;
   &lt;class&gt;MainWindow&lt;/class&gt;
   &lt;widget class=&quot;QMainWindow&quot; name=&quot;MainWindow&quot;&gt;
    &lt;property name=&quot;geometry&quot;&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;0&lt;/y&gt;
      &lt;width&gt;800&lt;/width&gt;
      &lt;height&gt;600&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;property name=&quot;windowTitle&quot;&gt;
     &lt;string&gt;MainWindow&lt;/string&gt;
    &lt;/property&gt;
    &lt;widget class=&quot;QWidget&quot; name=&quot;centralwidget&quot;&gt;
     &lt;widget class=&quot;PlotWidget&quot; name=&quot;graphicsView&quot;&gt;
      &lt;property name=&quot;geometry&quot;&gt;
       &lt;rect&gt;
        &lt;x&gt;30&lt;/x&gt;
        &lt;y&gt;20&lt;/y&gt;
        &lt;width&gt;671&lt;/width&gt;
        &lt;height&gt;471&lt;/height&gt;
       &lt;/rect&gt;
      &lt;/property&gt;
     &lt;/widget&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QMenuBar&quot; name=&quot;menubar&quot;&gt;
     &lt;property name=&quot;geometry&quot;&gt;
      &lt;rect&gt;
       &lt;x&gt;0&lt;/x&gt;
       &lt;y&gt;0&lt;/y&gt;
       &lt;width&gt;800&lt;/width&gt;
       &lt;height&gt;42&lt;/height&gt;
      &lt;/rect&gt;
     &lt;/property&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QStatusBar&quot; name=&quot;statusbar&quot;/&gt;
   &lt;/widget&gt;
   &lt;customwidgets&gt;
    &lt;customwidget&gt;
     &lt;class&gt;PlotWidget&lt;/class&gt;
     &lt;extends&gt;QGraphicsView&lt;/extends&gt;
     &lt;header&gt;pyqtgraph&lt;/header&gt;
    &lt;/customwidget&gt;
   &lt;/customwidgets&gt;
   &lt;resources/&gt;
   &lt;connections/&gt;
  &lt;/ui&gt;
  </code></pre>
  <hr />
  <p>update monday the 18th of october (2021) at 10:30am:</p>
  <p>It seems there could be a versioning problem, since my descriptions above were in the framework of a previous project using python 3.5. When I run these toy codes in a python 3.9 environment I get nothing displayed (not even the curves)... what's wrong ?</p>
  <hr />
  <p>update november 2, 10am</p>
  <ol>
  <li><p>I forgot to say the usual <code>addLegend()</code> command, like in matplotlib or in the answer below, doesn't work (no display, no message, nothing...)</p>
  </li>
  <li><p>everything's ok when I remove the lines:</p>
  <p>win.graphicsView.plot(x,y1, label='result number 1',symbol='x')
  win.graphicsView.plot(x,y2, label='result number 2',symbol='o')</p>
  </li>
  </ol>
  <p>and add:</p>
  <pre><code>c1 = win.graphicsView.plot(x,y1,symbol='x')
  c2 = win.graphicsView.plot(x,y2,symbol='o')
  import pyqtgraph as pg
  legend = pg.LegendItem((80, 60), offset=(70, 20))
  legend.setParentItem(win.graphicsView.graphicsItem())
  legend.addItem(c1, 'result number 1')
  legend.addItem(c2, 'result number 2')
  </code></pre>
  <p>just before the <code>show()</code>. I wonder why <code>addLegend()</code> is useless...</p>
  <p>But the main problem that was raised is solved, since I can display my labels.</p>