code: def display(self, data):
          
          value = self.config.value
          self.scene = QGraphicsScene(value['x_min'], value['y_min'],
                                      value['x_max'] - value['x_min'],
                                      value['y_max'] - value['y_min'])
          self.idx_fig.setScene(self.scene)
  
          self.add_grid()
          self.resizeEvent(None)
  
          s_freq = self.parent.traces.data.s_freq
          f, Pxx = welch(data, fs=s_freq,
                         nperseg=int(min((s_freq, len(data)))))  # force int
  
          freq_limit = (value['x_min'] <= f) & (f <= value['x_max'])
  
          if self.config.value['log']:
              Pxx_to_plot = log(Pxx[freq_limit])
          else:
              Pxx_to_plot = Pxx[freq_limit]
  
          self.scene.addPath(Path(f[freq_limit], Pxx_to_plot),
                             QPen(QColor(LINE_COLOR), LINE_WIDTH))
docs: Make graphicsitem for spectrum figure.
  
          Parameters
          ----------
          data : ndarray
              1D vector containing the data only
  
          This function can be called by self.display_window (which reads the
          data for the selected channel) or by the mouse-events functions in
          traces (which read chunks of data from the user-made selection).