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_()
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_()
# 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_())
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_()
def main(args): app = QApplication(args) demo = make() # app.setMainWidget(demo) app.exec_()
def main(args): app = QApplication(args) demo = make() app.exec_()
def main(args): app = QApplication(args) demo = BufferSizeDialog(10) demo.show() app.exec_()