def add_plot(self, name, units):
     # legend
     legend = QwtLegend()
     legend.setFrameStyle(Qt.QFrame.Box | Qt.QFrame.Sunken)
     legend.setItemMode(QwtLegend.ClickableItem)
     # plot
     plot = QwtPlot(self)
     plot.setTitle(name.upper())
     plot.setObjectName(name)
     plot.setCanvasBackground(Qt.Qt.white)
     plot.setAxisTitle(QwtPlot.xBottom, "time [s]")
     plot.insertLegend(legend, QwtPlot.RightLegend)
     plot.time = deque(maxlen=MAX_LENGTH)
     plot.data = []
     plot.curves = []
     for i, unit in enumerate(units):
         position = QwtPlot.yLeft if i == 0 else QwtPlot.yRight
         curve = QwtPlotCurve(LEGENDS[unit])
         curve.setPen(Qt.QPen(self.next_color(), 2))
         curve.setYAxis(position)
         curve.attach(plot)
         plot.enableAxis(position)
         plot.setAxisTitle(position, unit)
         plot.curves.append(curve)
         plot.data.append(deque(maxlen=MAX_LENGTH))
     self.vertical_layout.addWidget(plot)
     self._plots[name] = plot