Ejemplo n.º 1
0
def main(args):
    app = QApplication(args)
    x_values = numpy.array([1.0, 2.0, 3.0, 4.0])
    y_values = numpy.array([15.0, 25.0, 35.0, 45.0])
    flags = numpy.array([0.0, 0.0, 0.0, 0.0])
    demo = ZoomPopup(1, x_values, y_values, flags, Qt.yellow, None, None)
    demo.show()
    app.exec_()
Ejemplo n.º 2
0
def main(args):
    app = QApplication(args)
    demo = QwtPlot()
    grid = QwtPlotGrid()
    grid.attach(demo)
    grid.setPen(QPen(Qt.black, 0, Qt.DotLine))
    grid.enableX(True)
    grid.enableY(True)
    complex_divider = 50.0

    myXScale = ComplexScaleDraw(start_value=0.0, end_value=complex_divider)
    #print('myXScale', myXScale)
    demo.setAxisScaleDraw(QwtPlot.xBottom, myXScale)

    m = QwtPlotMarker()
    m.attach(demo)
    m.setValue(complex_divider, 0.0)
    m.setLineStyle(QwtPlotMarker.VLine)
    m.setLabelAlignment(Qt.AlignRight | Qt.AlignBottom)
    m.setLinePen(QPen(Qt.black, 2, Qt.SolidLine))

    vector_array = numpy.zeros((100, ), numpy.float32)
    for i in range(100):
        vector_array[i] = i

    curve = QwtPlotCurve('example data')
    curve.attach(demo)
    x_array = numpy.zeros(100, numpy.float32)
    y_array = numpy.zeros(100, numpy.float32)
    for i in range(100):
        x_array[i] = 1.0 * i
        y_array[i] = 2.0 * i
    curve.setSamples(x_array, y_array)

    demo.resize(600, 400)
    demo.replot()
    demo.show()
    #   app.setMainWidget(demo)
    app.exec_()
Ejemplo n.º 3
0
    # calculate data and errors for a curve with error bars
    x = np.arange(0, 10.1, 0.5, np.float)
    y = np.sin(x)
    dy = 0.2 * abs(y)
    # dy = (0.15 * abs(y), 0.25 * abs(y)) # uncomment for asymmetric error bars
    dx = 0.2  # all error bars the same size
    errorOnTop = False  # uncomment to draw the curve on top of the error bars
    # errorOnTop = True # uncomment to draw the error bars on top of the curve
    curve = ErrorBarPlotCurve(
        x=x,
        y=y,
        dx=dx,
        dy=dy,
        curvePen=QPen(Qt.black, 2),
        curveSymbol=QwtSymbol(QwtSymbol.Ellipse, QBrush(Qt.red),
                              QPen(Qt.black, 2), QSize(9, 9)),
        errorPen=QPen(Qt.blue, 2),
        errorCap=10,
        errorOnTop=errorOnTop,
    )
    curve.attach(demo)
    demo.resize(640, 480)
    demo.show()
    return demo


if __name__ == '__main__':
    app = QApplication(sys.argv)
    demo = make()
    sys.exit(app.exec_())
Ejemplo n.º 4
0
    def showInfo(self, text=""):
        self.statusBar().showMessage(text)
                
    def moved(self, point):
        info = "Freq=%g, Ampl=%g, Phase=%g" % (
            self.plot.invTransform(QwtPlot.xBottom, point.x()),
            self.plot.invTransform(QwtPlot.yLeft, point.y()),
            self.plot.invTransform(QwtPlot.yRight, point.y()))
        self.showInfo(info)

    def selected(self, _):
        self.showInfo()


def make():
    demo = BodeDemo()
    demo.resize(540, 400)
    demo.show()
    return demo


if __name__ == '__main__':
    app = QApplication(sys.argv)
    fonts = QFontDatabase()
    for name in ('Verdana', 'STIXGeneral'):
        if name in fonts.families():
            app.setFont(QFont(name))
            break
    demo = make()
    sys.exit(app.exec_())
Ejemplo n.º 5
0
        self.show()
        QApplication.processEvents()

        self.setCentralWidget(tabs)
        pts = 1000
        for points, symbols in zip((pts / 10, pts / 10, pts, pts),
                                   (True, False) * 2):
            t0 = time.time()
            widget = CSWidget(points, symbols)
            symtext = "with%s symbols" % ("" if symbols else "out")
            title = '%d points, %s' % (points, symtext)
            tabs.addTab(widget, title)
            tabs.setCurrentWidget(widget)

            # Force widget to refresh (for test purpose only)
            QApplication.processEvents()

            time_str = "Elapsed time: %d ms" % ((time.time() - t0) * 1000)
            widget.text.setText(time_str)
        tabs.setCurrentIndex(0)


if __name__ == '__main__':
    app = QApplication([])
    for name in ('Calibri', 'Verdana', 'Arial'):
        if name in QFontDatabase().families():
            app.setFont(QFont(name))
            break
    demo = BMDemo(100000)
    app.exec_()
Ejemplo n.º 6
0
def main(args):
    app = QApplication(args)
    demo = make()
#   app.setMainWidget(demo)
    app.exec_()
Ejemplo n.º 7
0
# -*- coding: utf-8 -*-
__author__ = 'Valeriy'

from qwt.qt.QtGui import QApplication
from qwt import QwtPlot, QwtPlotCurve
import numpy as np

app = QApplication([])

# x = [1,2,3,4,5,6,7,8,9]
# y1 = [3.2, 5.1 ,7.0, 4.24, 4.41, 8.34, 2.21, 5.657, 6.1]


x = []
y1 = []


my_plot = QwtPlot("Two curves")
curve1 = QwtPlotCurve("Curve 1")
my_plot.resize(600, 300)

curve1.setData(x, y1)
curve1.attach(my_plot)
# my_plot.replot()
my_plot.show()

app.exec_()

# SELECT PrepData FROM= Pdata WHERE ((PNameId=2) AND (SNameId = 14) AND (YearId=2012))
Ejemplo n.º 8
0
def main(args):
    app = QApplication(args)
    demo = make()
    app.exec_()
Ejemplo n.º 9
0
def main(args):
    app = QApplication(args)
    demo = BufferSizeDialog(10)
    demo.show()
    app.exec_()