Beispiel #1
0
    def __init__(self, parent=None):
        Qwt.QwtPlot.__init__(self, parent)
        self.canvas().setStyleSheet(
            "border: 2px solid Black;"
            "border-radius: 15px;"
            "background-color: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1,"
            "stop: 0 LemonChiffon, stop: 1 PaleGoldenrod );")

        # attach curve
        self.d_curve = Qwt.QwtPlotCurve("Scattered Points")
        self.d_curve.setPen(QColor("Purple"))

        # when using QwtPlotCurve.ImageBuffer simple dots can be
        # rendered in parallel on multicore systems.
        self.d_curve.setRenderThreadCount(
            0)  # 0: use QThread.idealThreadCount()
        self.d_curve.attach(self)
        self.setSymbol(None)
        # panning with the left mouse button
        Qwt.QwtPlotPanner(self.canvas())

        # distanve measurement with the right mouse button
        self.picker = DistancePicker(self.canvas())
        self.picker.setMousePattern(Qwt.QwtPlotPicker.MouseSelect1,
                                    Qt.RightButton)
        self.picker.setRubberBandPen(QPen(Qt.blue))
        # zoom in/out with the wheel
        self.magnifier = Qwt.QwtPlotMagnifier(self.canvas())
        self.magnifier.setMouseButton(Qt.NoButton)
Beispiel #2
0
    def __init__(self):
        super().__init__()
        self.setAutoFillBackground(True)
        self.setPalette(QPalette(QColor(165, 193, 228)))
        self.updateGradient()
        self.setTitle("A Simple QwtPlot Demonstration")
        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.RightLegend)

        #axes
        self.setAxisTitle(Qwt.QwtPlot.xBottom, "x -->")
        self.setAxisScale(Qwt.QwtPlot.xBottom, 0.0, 10.0)

        self.setAxisTitle(Qwt.QwtPlot.yLeft, "y -->")
        self.setAxisScale(Qwt.QwtPlot.yLeft, -1.0, 1.0)
        # canvas
        self.canvas = Qwt.QwtPlotCanvas()
        self.canvas.setLineWidth(1)
        self.canvas.setFrameStyle(QFrame.Box | QFrame.Plain)
        self.canvas.setBorderRadius(15)

        self.canvasPalette = QPalette(Qt.white)
        self.canvasPalette.setColor(QPalette.Foreground, QColor(133, 190, 232))
        self.canvas.setPalette(self.canvasPalette)

        self.setCanvas(self.canvas)

        #panning with the left mouse button
        self.panner = Qwt.QwtPlotPanner(self.canvas)

        #zoom in/out with the wheel
        self.magnifier = Qwt.QwtPlotMagnifier(self.canvas)
        self.magnifier.setMouseButton(Qt.NoButton)

        self.populate()