class QwtPlotE(QwtPlot):
    """a slightly enhanced version of QwtPlot which already has some sugar on it"""
    def __init__(self, *arg):
        QwtPlot.__init__(self, *arg)
        self.plotLayout().setAlignCanvasToScales(True)
        self.setCanvasBackground(Qt.white)
        self.legend = QwtLegend()
        self.legend.setItemMode(QwtLegend.ClickableItem)
        self.insertLegend(self.legend, QwtPlot.TopLegend)
        self.grid = QwtPlotGrid()
        self.grid.attach(self)
        self.grid.setPen(QPen(Qt.black, 0, Qt.DotLine))
        self.zoomer = QwtPlotZoomer(QwtPlot.xBottom, QwtPlot.yLeft, QwtPicker.DragSelection,
            QwtPicker.AlwaysOn, self.canvas())
        self.zoomer.setRubberBandPen(QPen(Qt.green))
        self.zoomer.setTrackerPen(QPen(Qt.red))
        self.magnifier = QwtPlotMagnifier(self.canvas())
        self.panner = QwtPlotPanner(self.canvas())
        self.panner.setMouseButton(Qt.LeftButton, Qt.ControlModifier)
        self.connect(self, SIGNAL("legendClicked(QwtPlotItem*)"), self.togglePlotItemVisibility)

    def togglePlotItemVisibility(self, plotItem):
        """Toggle the visibility of a plot item"""
        plotItem.setVisible(not plotItem.isVisible())
        self.replot()