• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python qwt.QwtPlotCurve类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中qwt.QwtPlotCurve的典型用法代码示例。如果您正苦于以下问题:Python QwtPlotCurve类的具体用法?Python QwtPlotCurve怎么用?Python QwtPlotCurve使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了QwtPlotCurve类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: MyWindow

class MyWindow(QtGui.QMainWindow):
    """
    This class implements a derivative of
    PyQt4.QtGui.QMainWindow, a complete application
    window, which can feature menus, submenus,
    status bar, etc. In this example, it uses
    few of those features.
    """

    def __init__(self, parent=None):
        """
        Constructor: creates an instance of MyWindow
        """
        #########################################
        # Necessary actions, which must be done #
        # for any project                       #
        #########################################
        # first, calling the ancestor's creator
        QtGui.QMainWindow.__init__(self, parent)
        # get the User Interface from the module UI_p1
        self.ui=Ui_MainWindow()
        # initialize the user interface
        self.ui.setupUi(self)
        #########################################
        # Custom actions, which can be written  #
        # in other ways for other projects.     #
        #########################################
        # aliases for some parts of the user interface
        self.plotWidget    = self.ui.qwtPlot
        self.measureButton = self.ui.measureButton
        self.closeButton   = self.ui.closeButton
        # connect methods to buttons' click signals
        self.measureButton.clicked.connect(self.measure)
        self.closeButton.clicked.connect(self.close)
        # initialize an empty curve for the plot widget
        self.curve         = QwtPlotCurve()
        self.curve.attach(self.plotWidget)
        return

    def measure(self):
        """
        This is a custom method to connect to the
        button for measurements.
        There is no need for another custom method,
        since the method "close" is already inherited
        from the ancestor class.
        """
        # create data for a curve with some fixed
        # and some random features
        import random
        x=np.arange(0,8,1e-2)      # abscissa: [0, 0.01, 0.02, ... 7.99]
        r=random.random()
        y=np.sin(x)+r*np.sin(3*x)  # calculated ordinate
        # feed new data into the curve
        self.curve.setData(x,y,len(x))
        # change the title of the plot on the fly
        self.plotWidget.setTitle("sin(x) + {} sin(3x)".format(r))
        # display the result
        self.plotWidget.replot()
        return
开发者ID:georgesk,项目名称:course-affordable-science,代码行数:60,代码来源:p1.py


示例2: __init__

    def __init__(self, *args):
        QwtPlot.__init__(self, *args)

        self.setCanvasBackground(Qt.white)
        self.alignScales()

        # Initialize data
        self.x = np.arange(0.0, 100.1, 0.5)
        self.y = np.zeros(len(self.x), np.float)
        self.z = np.zeros(len(self.x), np.float)

        self.setTitle("A Moving QwtPlot Demonstration")
        self.insertLegend(QwtLegend(), QwtPlot.BottomLegend)

        self.curveR = QwtPlotCurve("Data Moving Right")
        self.curveR.attach(self)
        self.curveL = QwtPlotCurve("Data Moving Left")
        self.curveL.attach(self)

        self.curveL.setSymbol(QwtSymbol(QwtSymbol.Ellipse, QBrush(), QPen(Qt.yellow), QSize(7, 7)))

        self.curveR.setPen(QPen(Qt.red))
        self.curveL.setPen(QPen(Qt.blue))

        mY = QwtPlotMarker()
        mY.setLabelAlignment(Qt.AlignRight | Qt.AlignTop)
        mY.setLineStyle(QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        self.setAxisTitle(QwtPlot.xBottom, "Time (seconds)")
        self.setAxisTitle(QwtPlot.yLeft, "Values")

        self.startTimer(50)
        self.phase = 0.0
开发者ID:petebachant,项目名称:python-qwt,代码行数:35,代码来源:DataDemo.py


示例3: Example

class Example(QtGui.QWidget):
    
    def __init__(self):
        super(Example, self).__init__()        
        self.initUI()


        self.current_y = 0

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.update_plot)
        self.timer.setInterval(1000/FREQ)
        self.timer.start()
        
        
    def initUI(self):
        
        self.setGeometry(300, 300, 1000, 1000)
        self.setWindowTitle('Icon')
        self.setWindowIcon(QtGui.QIcon('web.png'))
        self.plot = QwtPlot("Test", self)
        self.plot.resize(900, 900)
        self.curve = QwtPlotCurve("Curve 1")
        self.curve.attach(self.plot)
        self.show()

    def update_plot(self):
        self.curve.setData(x, ys[self.current_y])
        self.current_y = (self.current_y + 1) % YS
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:29,代码来源:test_pyqwt.py


示例4: MyWindow

class MyWindow(QtGui.QMainWindow):
    """
    This class implements a derivative of
    PyQt4.QtGui.QMainWindow, a complete application
    window, which can feature menus, submenus,
    status bar, etc. In this example, it uses
    few of those features.
    """

    def __init__(self, parent=None):
        """
        Constructor: creates an instance of MyWindow
        """
        #########################################
        # Necessary actions, which must be done #
        # for any project                       #
        #########################################
        # first, calling the ancestor's creator
        QtGui.QMainWindow.__init__(self, parent)
        # get the User Interface from the module UI_p1
        self.ui=Ui_MainWindow()
        # initialize the user interface
        self.ui.setupUi(self)
        #########################################
        # Custom actions, which can be written  #
        # in other ways for other projects.     #
        #########################################
        # aliases for some parts of the user interface
        self.plotWidget    = self.ui.qwtPlot
        self.measureButton = self.ui.measureButton
        self.closeButton   = self.ui.closeButton
        # connect methods to buttons' click signals
        self.measureButton.clicked.connect(self.measure)
        self.closeButton.clicked.connect(self.close)
        # initialize an empty curve for the plot widget
        self.curve         = QwtPlotCurve()
        self.curve.attach(self.plotWidget)
        # initialize the driver for expEYES Junior
        self.p             = ej.open()
        return

    def measure(self):
        """
        This is a custom method to connect to the
        button for measurements.
        There is no need for another custom method,
        since the method "close" is already inherited
        from the ancestor class.
        """
        t,v = self.p.capture(1,1000,200)
        self.curve.setData(t,v,len(t))
        # display the result
        self.plotWidget.replot()
        return
开发者ID:georgesk,项目名称:course-affordable-science,代码行数:54,代码来源:p2.py


示例5: __init__

 def __init__(self, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     self.ui=Ui_MainWindow()
     self.ui.setupUi(self)
     # connect methods to buttons' click signals
     self.ui.wakeUpButton.clicked.connect(self.wakeUp)
     self.ui.stopButton.clicked.connect(self.stop)
     self.ui.closeButton.clicked.connect(self.close)
     self.ui.saveButton.clicked.connect(self.save)
     self.ui.immediateButton.clicked.connect(self.immediate)
     self.ui.finalButton.clicked.connect(self.final)
     self.ui.fitButton.clicked.connect(self.fit)
     self.ui.action_Save_Ctrl_S.triggered.connect(self.save)
     self.ui.action_Quit_Ctrl_Q.triggered.connect(self.close)
     self.ui.actionManual.triggered.connect(self.manual)
     self.ui.actionAbout.triggered.connect(self.about)
     self.ui.durationEdit.textChanged.connect(self.durationChanged)
     # create a timer
     self.stopTime=time.time()
     self.timer=QtCore.QTimer()
     # connect the timer to the "tick" callback method
     self.timer.timeout.connect(self.tick)
     # 20 times per second
     self.timer.start(50)
     # initialize an empty curve for the plot widget
     self.curve         = QwtPlotCurve()
     self.curve0        = QwtPlotCurve()
     self.fitCurve1     = QwtPlotCurve()
     self.fitCurve2     = QwtPlotCurve()
     self.fitCurve3     = QwtPlotCurve()
     self.curve.attach(self.ui.qwtPlot)
     self.curve0.attach(self.ui.qwtPlot)
     self.fitCurve1.attach(self.ui.qwtPlot)
     self.fitCurve2.attach(self.ui.qwtPlot)
     self.fitCurve3.attach(self.ui.qwtPlot)
     # adjust the axis scales based on duration = 15 s
     self.durationChanged(15, ampl=5)
     # set the maxvalue for the threshold rate (in V/s)
     self.maxthreshold=150/15 # = 150/duration
     # expEYESdetection and initialization
     try:
         self.p             = ej.open()
         assert(self.p.fd)
         self.setWindowTitle("expEYES Junior found on port {}".format(
             self.p.fd.port
         ))
     except:
         self.setWindowTitle("ERROR: expEYES Junior NOT FOUND!")
         self.ui.wakeUpButton.setEnabled(False)
     # custom properties
     self.isImmediate=True
     return
开发者ID:georgesk,项目名称:course-affordable-science,代码行数:52,代码来源:oscill4.py


示例6: __init__

 def __init__(self, parent=None):
     """
     Constructor: creates an instance of MyWindow
     """
     #########################################
     # Necessary actions, which must be done #
     # for any project                       #
     #########################################
     # first, calling the ancestor's creator
     QtGui.QMainWindow.__init__(self, parent)
     # get the User Interface from the module UI_p1
     self.ui=Ui_MainWindow()
     # initialize the user interface
     self.ui.setupUi(self)
     #########################################
     # Custom actions, which can be written  #
     # in other ways for other projects.     #
     #########################################
     # aliases for some parts of the user interface
     self.plotWidget    = self.ui.qwtPlot
     self.measureButton = self.ui.measureButton
     self.closeButton   = self.ui.closeButton
     # connect methods to buttons' click signals
     self.measureButton.clicked.connect(self.measure)
     self.closeButton.clicked.connect(self.close)
     # initialize 4 empty curves for the plot widget
     self.curves=[]
     colors=[
       QtGui.QColor("#000000"), #black
       QtGui.QColor("#ff0000"), #red
       QtGui.QColor("#0000ff"), #blue
       QtGui.QColor("#00cc00"), #dark green
     ]
     for i in range(4):
         c=QwtPlotCurve()
         c.setPen(colors[i])
         self.curves.append(c)
         c.attach(self.plotWidget)
     # initialize the driver for expEYES Junior
     # prevent an error if the box is not detected
     try:
         self.p             = ej.open()
         assert(self.p.fd)
         self.setWindowTitle("expEYES Junior found on port {}".format(
             self.p.fd.port
         ))
     except:
         self.setWindowTitle("ERROR: expEYES Junior NOT FOUND!")
         self.measureButton.setEnabled(False)
     return
开发者ID:georgesk,项目名称:course-affordable-science,代码行数:50,代码来源:p1.py


示例7: setData

    def setData(self, *args):
        """Set x versus y data with error bars in dx and dy.

        Horizontal error bars are plotted if dx is not None.
        Vertical error bars are plotted if dy is not None.

        x and y must be sequences with a shape (N,) and dx and dy must be
        sequences (if not None) with a shape (), (N,), or (2, N):
        - if dx or dy has a shape () or (N,), the error bars are given by
          (x-dx, x+dx) or (y-dy, y+dy),
        - if dx or dy has a shape (2, N), the error bars are given by
          (x-dx[0], x+dx[1]) or (y-dy[0], y+dy[1]).
        """
        if len(args) == 1:
            QwtPlotCurve.setData(self, *args)
            return
            
        dx = None
        dy = None
        x, y = args[:2]
        if len(args) > 2:
            dx = args[2]
            if len(args) > 3:
                dy = args[3]
        
        self.__x = np.asarray(x, np.float)
        if len(self.__x.shape) != 1:
            raise RuntimeError('len(asarray(x).shape) != 1')

        self.__y = np.asarray(y, np.float)
        if len(self.__y.shape) != 1:
            raise RuntimeError('len(asarray(y).shape) != 1')
        if len(self.__x) != len(self.__y):
            raise RuntimeError('len(asarray(x)) != len(asarray(y))')

        if dx is None:
            self.__dx = None
        else:
            self.__dx = np.asarray(dx, np.float)
        if len(self.__dx.shape) not in [0, 1, 2]:
            raise RuntimeError('len(asarray(dx).shape) not in [0, 1, 2]')
            
        if dy is None:
            self.__dy = dy
        else:
            self.__dy = np.asarray(dy, np.float)
        if len(self.__dy.shape) not in [0, 1, 2]:
            raise RuntimeError('len(asarray(dy).shape) not in [0, 1, 2]')
        
        QwtPlotCurve.setData(self, self.__x, self.__y)
开发者ID:PierreRaybaut,项目名称:plotpy,代码行数:50,代码来源:ErrorBarDemo.py


示例8: __init__

    def __init__(self, x=[], y=[], dx=None, dy=None, curvePen=None,
                 curveStyle=None, curveSymbol=None, errorPen=None,
                 errorCap=0, errorOnTop=False):
        """A curve of x versus y data with error bars in dx and dy.

        Horizontal error bars are plotted if dx is not None.
        Vertical error bars are plotted if dy is not None.

        x and y must be sequences with a shape (N,) and dx and dy must be
        sequences (if not None) with a shape (), (N,), or (2, N):
        - if dx or dy has a shape () or (N,), the error bars are given by
          (x-dx, x+dx) or (y-dy, y+dy),
        - if dx or dy has a shape (2, N), the error bars are given by
          (x-dx[0], x+dx[1]) or (y-dy[0], y+dy[1]).

        curvePen is the pen used to plot the curve
        
        curveStyle is the style used to plot the curve
        
        curveSymbol is the symbol used to plot the symbols
        
        errorPen is the pen used to plot the error bars
        
        errorCap is the size of the error bar caps
        
        errorOnTop is a boolean:
        - if True, plot the error bars on top of the curve,
        - if False, plot the curve on top of the error bars.
        """

        QwtPlotCurve.__init__(self)
        
        if curvePen is None:
            curvePen = QPen(Qt.NoPen)
        if curveStyle is None:
            curveStyle = QwtPlotCurve.Lines
        if curveSymbol is None:
            curveSymbol = QwtSymbol()
        if errorPen is None:
            errorPen = QPen(Qt.NoPen)
        
        self.setData(x, y, dx, dy)
        self.setPen(curvePen)
        self.setStyle(curveStyle)
        self.setSymbol(curveSymbol)
        self.errorPen = errorPen
        self.errorCap = errorCap
        self.errorOnTop = errorOnTop
开发者ID:PierreRaybaut,项目名称:plotpy,代码行数:48,代码来源:ErrorBarDemo.py


示例9: __init__

 def __init__(self, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     self.ui=Ui_MainWindow()
     self.ui.setupUi(self)
     # connect methods to buttons' click signals
     self.ui.wakeUpButton.clicked.connect(self.wakeUp)
     self.ui.stopButton.clicked.connect(self.stop)
     self.ui.closeButton.clicked.connect(self.close)
     self.ui.saveButton.clicked.connect(self.save)
     self.ui.immediateButton.clicked.connect(self.immediate)
     self.ui.finalButton.clicked.connect(self.final)
     self.ui.fitButton.clicked.connect(self.fit)
     self.ui.action_Save_Ctrl_S.triggered.connect(self.save)
     self.ui.action_Quit_Ctrl_Q.triggered.connect(self.close)
     self.ui.actionManual.triggered.connect(self.manual)
     self.ui.actionAbout.triggered.connect(self.about)
     # initialize an empty curve for the plot widget
     self.curve         = QwtPlotCurve()
     self.curve.attach(self.ui.qwtPlot)
     # expEYESdetection and initialization
     try:
         self.p             = ej.open()
         assert(self.p.fd)
         self.setWindowTitle("expEYES Junior found on port {}".format(
             self.p.fd.port
         ))
     except:
         self.setWindowTitle("ERROR: expEYES Junior NOT FOUND!")
         self.wakeUpButton.setEnabled(False)
     # custom properties
     self.isImmediate=True
     return
开发者ID:georgesk,项目名称:course-affordable-science,代码行数:32,代码来源:oscill2.py


示例10: __init__

 def __init__(self, parent=None):
     """
     Constructor: creates an instance of MyWindow
     """
     #########################################
     # Necessary actions, which must be done #
     # for any project                       #
     #########################################
     # first, calling the ancestor's creator
     QtGui.QMainWindow.__init__(self, parent)
     # get the User Interface from the module UI_p1
     self.ui=Ui_MainWindow()
     # initialize the user interface
     self.ui.setupUi(self)
     #########################################
     # Custom actions, which can be written  #
     # in other ways for other projects.     #
     #########################################
     # aliases for some parts of the user interface
     self.plotWidget    = self.ui.qwtPlot
     self.measureButton = self.ui.measureButton
     self.closeButton   = self.ui.closeButton
     # connect methods to buttons' click signals
     self.measureButton.clicked.connect(self.measure)
     self.closeButton.clicked.connect(self.close)
     # initialize an empty curve for the plot widget
     self.curve         = QwtPlotCurve()
     self.curve.attach(self.plotWidget)
     # initialize the driver for expEYES Junior
     self.p             = ej.open()
     return
开发者ID:georgesk,项目名称:course-affordable-science,代码行数:31,代码来源:p2.py


示例11: __init__

 def __init__(self, *args):
     QMainWindow.__init__(self, *args)
     self.plot = QwtPlot(self)
     self.plot.setTitle("A Simple Map Demonstration")
     self.plot.setCanvasBackground(Qt.white)
     self.plot.setAxisTitle(QwtPlot.xBottom, "x")
     self.plot.setAxisTitle(QwtPlot.yLeft, "y")    
     self.plot.setAxisScale(QwtPlot.xBottom, 0.0, 1.0)
     self.plot.setAxisScale(QwtPlot.yLeft, 0.0, 1.0)
     self.setCentralWidget(self.plot)
     # Initialize map data
     self.count = self.i = 1000
     self.xs = np.zeros(self.count, np.float)
     self.ys = np.zeros(self.count, np.float)
     self.kappa = 0.2
     self.curve = QwtPlotCurve("Map")
     self.curve.attach(self.plot)
     self.curve.setSymbol(QwtSymbol(QwtSymbol.Ellipse,
                                        QBrush(Qt.red),
                                        QPen(Qt.blue),
                                        QSize(5, 5)))
     self.curve.setPen(QPen(Qt.cyan))
     toolBar = QToolBar(self)
     self.addToolBar(toolBar)
     # 1 tick = 1 ms, 10 ticks = 10 ms (Linux clock is 100 Hz)
     self.ticks = 10
     self.tid = self.startTimer(self.ticks)
     self.timer_tic = None
     self.user_tic = None
     self.system_tic = None    
     self.plot.replot()
开发者ID:PierreRaybaut,项目名称:plotpy,代码行数:31,代码来源:MapDemo.py


示例12: __init__

    def __init__(self, *args):
        QFrame.__init__(self, *args)

        self.xMap = QwtScaleMap()
        self.xMap.setScaleInterval(-0.5, 10.5)
        self.yMap = QwtScaleMap()
        self.yMap.setScaleInterval(-1.1, 1.1)

        # frame style
        self.setFrameStyle(QFrame.Box | QFrame.Raised)
        self.setLineWidth(2)
        self.setMidLineWidth(3)

        # calculate values
        self.x = np.arange(0, 10.0, 10.0/27)
        self.y = np.sin(self.x)*np.cos(2*self.x)

        # make curves with different styles
        self.curves = []
        self.titles = []

        # curve 2
        self.titles.append('Style: Lines, Symbol: None')
        curve = QwtPlotCurve()
        curve.setPen(QPen(Qt.darkBlue))
        curve.setStyle(QwtPlotCurve.Lines)
        self.curves.append(curve)

        # attach data, using Numeric
        for curve in self.curves:
            curve.setData(self.x, self.y)
开发者ID:valeriy67,项目名称:Cquality,代码行数:31,代码来源:tempdraw.py


示例13: initUI

 def initUI(self):
     
     self.setGeometry(300, 300, 1000, 1000)
     self.setWindowTitle('Icon')
     self.setWindowIcon(QtGui.QIcon('web.png'))
     self.plot = QwtPlot("Test", self)
     self.plot.resize(900, 900)
     self.curve = QwtPlotCurve("Curve 1")
     self.curve.attach(self.plot)
     self.show()
开发者ID:CINF,项目名称:PyExpLabSys,代码行数:10,代码来源:test_pyqwt.py


示例14: create_log_plot

def create_log_plot():
    plot = QwtPlot('LogCurveDemo.py (or how to handle -inf values)')
    plot.enableAxis(QwtPlot.xBottom)
    plot.setAxisScaleEngine(QwtPlot.yLeft, QwtLogScaleEngine())
    curve = QwtPlotCurve()
    curve.setRenderHint(QwtPlotCurve.RenderAntialiased)
    pen = QPen(Qt.magenta)
    pen.setWidth(1.5)
    curve.setPen(pen)
    curve.attach(plot)
    x = np.arange(0.0, 10.0, 0.1)
    y = 10*np.cos(x)**2-.1
    print("y<=0:", y<=0)
    curve.setData(x, y)
    plot.replot()
    return plot
开发者ID:PierreRaybaut,项目名称:PythonQwt,代码行数:16,代码来源:LogCurveDemo.py


示例15: DataPlot

class DataPlot(QwtPlot):

    def __init__(self, *args):
        QwtPlot.__init__(self, *args)

        self.setCanvasBackground(Qt.white)
        self.alignScales()

        # Initialize data
        self.x = np.arange(0.0, 100.1, 0.5)
        self.y = np.zeros(len(self.x), np.float)
        self.z = np.zeros(len(self.x), np.float)

        self.setTitle("A Moving QwtPlot Demonstration")
        self.insertLegend(QwtLegend(), QwtPlot.BottomLegend);

        self.curveR = QwtPlotCurve("Data Moving Right")
        self.curveR.attach(self)
        self.curveL = QwtPlotCurve("Data Moving Left")
        self.curveL.attach(self)

        self.curveL.setSymbol(QwtSymbol(QwtSymbol.Ellipse,
                                        QBrush(),
                                        QPen(Qt.yellow),
                                        QSize(7, 7)))

        self.curveR.setPen(QPen(Qt.red))
        self.curveL.setPen(QPen(Qt.blue))

        mY = QwtPlotMarker()
        mY.setLabelAlignment(Qt.AlignRight | Qt.AlignTop)
        mY.setLineStyle(QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        self.setAxisTitle(QwtPlot.xBottom, "Time (seconds)")
        self.setAxisTitle(QwtPlot.yLeft, "Values")
    
        self.startTimer(50)
        self.phase = 0.0

    def alignScales(self):
        self.canvas().setFrameStyle(QFrame.Box | QFrame.Plain)
        self.canvas().setLineWidth(1)
        for i in range(QwtPlot.axisCnt):
            scaleWidget = self.axisWidget(i)
            if scaleWidget:
                scaleWidget.setMargin(0)
            scaleDraw = self.axisScaleDraw(i)
            if scaleDraw:
                scaleDraw.enableComponent(QwtAbstractScaleDraw.Backbone, False)
    
    def timerEvent(self, e):
        if self.phase > np.pi - 0.0001:
            self.phase = 0.0

        # y moves from left to right:
        # shift y array right and assign new value y[0]
        self.y = np.concatenate((self.y[:1], self.y[:-1]), 1)
        self.y[0] = np.sin(self.phase) * (-1.0 + 2.0*random.random())
		
        # z moves from right to left:
        # Shift z array left and assign new value to z[n-1].
        self.z = np.concatenate((self.z[1:], self.z[:1]), 1)
        self.z[-1] = 0.8 - (2.0 * self.phase/np.pi) + 0.4*random.random()

        self.curveR.setData(self.x, self.y)
        self.curveL.setData(self.x, self.z)

        self.replot()
        self.phase += np.pi*0.02
开发者ID:PierreRaybaut,项目名称:plotpy,代码行数:71,代码来源:DataDemo.py


示例16: __init__

    def __init__(self, *args):
        QWidget.__init__(self, *args)
        layout = QGridLayout(self)        
        # try to create a plot for SciPy arrays

        # make a curve and copy the data
        numpy_curve = QwtPlotCurve('y = lorentzian(x)')
        x = np.arange(0.0, 10.0, 0.01)
        y = lorentzian(x)
        numpy_curve.setData(x, y)
        # here, we know we can plot NumPy arrays
        numpy_plot = QwtPlot(self)
        numpy_plot.setTitle('numpy array')
        numpy_plot.setCanvasBackground(Qt.white)
        numpy_plot.plotLayout().setCanvasMargin(0)
        numpy_plot.plotLayout().setAlignCanvasToScales(True)
        # insert a curve and make it red
        numpy_curve.attach(numpy_plot)
        numpy_curve.setPen(QPen(Qt.red))
        layout.addWidget(numpy_plot, 0, 0)
        numpy_plot.replot()

        # create a plot widget for lists of Python floats
        list_plot = QwtPlot(self)
        list_plot.setTitle('Python list')
        list_plot.setCanvasBackground(Qt.white)
        list_plot.plotLayout().setCanvasMargin(0)
        list_plot.plotLayout().setAlignCanvasToScales(True)
        x = drange(0.0, 10.0, 0.01)
        y = [lorentzian(item) for item in x]
        # insert a curve, make it red and copy the lists
        list_curve = QwtPlotCurve('y = lorentzian(x)')
        list_curve.attach(list_plot)
        list_curve.setPen(QPen(Qt.red))
        list_curve.setData(x, y)
        layout.addWidget(list_plot, 0, 1)
        list_plot.replot()
开发者ID:PierreRaybaut,项目名称:plotpy,代码行数:37,代码来源:MultiDemo.py


示例17: __init__

 def __init__(self, title, xdata, ydata, style, symbol=None, *args):
     super(BMPlot, self).__init__(*args)
     self.setMinimumSize(200, 200)
     self.setTitle(title)
     self.setAxisTitle(QwtPlot.xBottom, 'x')
     self.setAxisTitle(QwtPlot.yLeft, 'y')
     curve = QwtPlotCurve()
     curve.setPen(QPen(get_curve_color()))
     curve.setStyle(style)
     curve.setRenderHint(QwtPlotCurve.RenderAntialiased)
     if symbol is not None:
         curve.setSymbol(symbol)
     curve.attach(self)
     curve.setData(xdata, ydata)
     self.replot()
开发者ID:gyenney,项目名称:Tools,代码行数:15,代码来源:CurveBenchmark.py


示例18: MapDemo

class MapDemo(QMainWindow):
    def __init__(self, *args):
        QMainWindow.__init__(self, *args)
        self.plot = QwtPlot(self)
        self.plot.setTitle("A Simple Map Demonstration")
        self.plot.setCanvasBackground(Qt.white)
        self.plot.setAxisTitle(QwtPlot.xBottom, "x")
        self.plot.setAxisTitle(QwtPlot.yLeft, "y")    
        self.plot.setAxisScale(QwtPlot.xBottom, 0.0, 1.0)
        self.plot.setAxisScale(QwtPlot.yLeft, 0.0, 1.0)
        self.setCentralWidget(self.plot)
        # Initialize map data
        self.count = self.i = 1000
        self.xs = np.zeros(self.count, np.float)
        self.ys = np.zeros(self.count, np.float)
        self.kappa = 0.2
        self.curve = QwtPlotCurve("Map")
        self.curve.attach(self.plot)
        self.curve.setSymbol(QwtSymbol(QwtSymbol.Ellipse,
                                           QBrush(Qt.red),
                                           QPen(Qt.blue),
                                           QSize(5, 5)))
        self.curve.setPen(QPen(Qt.cyan))
        toolBar = QToolBar(self)
        self.addToolBar(toolBar)
        # 1 tick = 1 ms, 10 ticks = 10 ms (Linux clock is 100 Hz)
        self.ticks = 10
        self.tid = self.startTimer(self.ticks)
        self.timer_tic = None
        self.user_tic = None
        self.system_tic = None    
        self.plot.replot()

    def setTicks(self, ticks):
        self.i = self.count
        self.ticks = int(ticks)
        self.killTimer(self.tid)
        self.tid = self.startTimer(ticks)
        
    def resizeEvent(self, event):
        self.plot.resize(event.size())
        self.plot.move(0, 0)

    def moreData(self):
        if self.i == self.count:
            self.i = 0
            self.x = random.random()
            self.y = random.random()
            self.xs[self.i] = self.x
            self.ys[self.i] = self.y
            self.i += 1
            chunks = []
            self.timer_toc = time.time()
            if self.timer_tic:
                chunks.append("wall: %s s." % (self.timer_toc-self.timer_tic))
                print(' '.join(chunks))
            self.timer_tic = self.timer_toc
        else:
            self.x, self.y = standard_map(self.x, self.y, self.kappa)
            self.xs[self.i] = self.x
            self.ys[self.i] = self.y
            self.i += 1
        
    def timerEvent(self, e):
        self.moreData()
        self.curve.setData(self.xs[:self.i], self.ys[:self.i])
        self.plot.replot()
开发者ID:PierreRaybaut,项目名称:plotpy,代码行数:67,代码来源:MapDemo.py


示例19: __init__

    def __init__(self, *args):
        QwtPlot.__init__(self, *args)
        self.setTitle('ReallySimpleDemo.py')
        self.insertLegend(QwtLegend(), QwtPlot.RightLegend)
        self.setAxisTitle(QwtPlot.xBottom, 'x -->')
        self.setAxisTitle(QwtPlot.yLeft, 'y -->')
        self.enableAxis(self.xBottom)

        # insert a few curves
        cSin = QwtPlotCurve('y = sin(x)')
        cSin.setPen(QPen(Qt.red))
        cSin.attach(self)
        cCos = QwtPlotCurve('y = cos(x)')
        cCos.setPen(QPen(Qt.blue))
        cCos.attach(self)
        
        # make a Numeric array for the horizontal data
        x = np.arange(0.0, 10.0, 0.1)

        # initialize the data
        cSin.setData(x, np.sin(x))
        cCos.setData(x, np.cos(x))

        # insert a horizontal marker at y = 0
        mY = QwtPlotMarker()
        mY.setLabel(QwtText('y = 0'))
        mY.setLabelAlignment(Qt.AlignRight | Qt.AlignTop)
        mY.setLineStyle(QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        # insert a vertical marker at x = 2 pi
        mX = QwtPlotMarker()
        mX.setLabel(QwtText('x = 2 pi'))
        mX.setLabelAlignment(Qt.AlignRight | Qt.AlignTop)
        mX.setLineStyle(QwtPlotMarker.VLine)
        mX.setXValue(2*np.pi)
        mX.attach(self)

        # replot
        self.replot()
开发者ID:gyenney,项目名称:Tools,代码行数:41,代码来源:ReallySimpleDemo.py


示例20: __init__

 def __init__(self, *args):
     QwtPlot.__init__(self, *args)
     self.setTitle("Cartesian Coordinate System Demo")
     # create a plot with a white canvas
     self.setCanvasBackground(Qt.white)
     # set plot layout
     self.plotLayout().setCanvasMargin(0)
     self.plotLayout().setAlignCanvasToScales(True)
     # attach a grid
     grid = QwtPlotGrid()
     grid.attach(self)
     grid.setPen(QPen(Qt.black, 0, Qt.DotLine))
     # attach a x-axis
     xaxis = CartesianAxis(QwtPlot.xBottom, QwtPlot.yLeft)
     xaxis.attach(self)
     self.enableAxis(QwtPlot.xBottom, False)
     # attach a y-axis
     yaxis = CartesianAxis(QwtPlot.yLeft, QwtPlot.xBottom)
     yaxis.attach(self)
     self.enableAxis(QwtPlot.yLeft, False)
     # calculate 3 NumPy arrays
     x = np.arange(-2 * np.pi, 2 * np.pi, 0.01)
     y = np.pi * np.sin(x)
     z = 4 * np.pi * np.cos(x) * np.cos(x) * np.sin(x)
     # attach a curve
     curve = QwtPlotCurve("y = pi*sin(x)")
     curve.attach(self)
     curve.setPen(QPen(Qt.green, 2))
     curve.setData(x, y)
     # attach another curve
     curve = QwtPlotCurve("y = 4*pi*sin(x)*cos(x)**2")
     curve.attach(self)
     curve.setPen(QPen(Qt.black, 2))
     curve.setData(x, z)
     self.replot()
开发者ID:gyenney,项目名称:Tools,代码行数:35,代码来源:CartesianDemo.py



注:本文中的qwt.QwtPlotCurve类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python painter.QwtPainter类代码示例发布时间:2022-05-26
下一篇:
Python engine.precache_sound函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap