title: How to make a label inside a PlotWidget?
body: <p>I'm making a GUI using Qt and pyqtgraph. It's got several PlotWidgets in it - here's a section of it:</p>
  
  <p><a href="https://i.stack.imgur.com/brX4W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/brX4W.png" alt="GUI with a plot"></a></p>
  
  <p>I'd like to include the mouse cursor position (in scaled units) as a label within the plot, a bit like the pyqtgraph crosshair example:</p>
  
  <p><a href="https://i.stack.imgur.com/A8oLE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A8oLE.png" alt="pygraph crosshair example"></a></p>
  
  <p>The example works by adding a <code>LabelItem</code> to a <code>GraphicsWindow</code> like this:</p>
  
  <pre><code>win = pg.GraphicsWindow()
  label = pg.LabelItem(justify='right')
  p1 = win.addPlot(row=1, col=0)
  </code></pre>
  
  <p>But I don't have a <code>GraphicsWindow</code>, just a normal Qt window (built using the Designer) with PlotWidgets in it. I can't seem to add a <code>LabelItem</code> or a <code>TextItem</code> to a <code>PlotWidget</code>. I'm sure there must be a 'standard' way of doing this, but I can't figure it out and Google doesn't seem to know. Any ideas?</p>
  
  <p><strong>Edit</strong>: here's a snippet of my code from the window's <code>__init__</code> function:</p>
  
  <pre><code>self.B_field_plot.setLabels(title='Magnetic field', left='B [T]', bottom='z [m]')
  self.label = pg.LabelItem(justify="right")
  self.B_field_plot.addItem(self.label)
  self.label.setText('Hello')
  </code></pre>
  
  <p>The label does not appear.</p>