当前位置: 首页>>代码示例>>Python>>正文


Python pyqtgraph.PlotDataItem方法代码示例

本文整理汇总了Python中pyqtgraph.PlotDataItem方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.PlotDataItem方法的具体用法?Python pyqtgraph.PlotDataItem怎么用?Python pyqtgraph.PlotDataItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtgraph的用法示例。


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

示例1: test_fft

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def test_fft():
    f = 20.
    x = np.linspace(0, 1, 1000)
    y = np.sin(2 * np.pi * f * x)
    pd = pg.PlotDataItem(x, y)
    pd.setFftMode(True)    
    x, y = pd.getData()
    assert abs(x[np.argmax(y)] - f) < 0.03
    
    x = np.linspace(0, 1, 1001)
    y = np.sin(2 * np.pi * f * x)
    pd.setData(x, y)
    x, y = pd.getData()
    assert abs(x[np.argmax(y)]- f) < 0.03
    
    pd.setLogMode(True, False)
    x, y = pd.getData()
    assert abs(x[np.argmax(y)] - np.log10(f)) < 0.01 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:20,代码来源:test_PlotDataItem.py

示例2: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def __init__(self, parent_plot):
        KiteSubplot.__init__(self, parent_plot)

        self.aps_correlation = pg.ScatterPlotItem(
            antialias=True,
            brush=brush_aps,
            pen=pen_aps,
            size=4)

        self.aps_model = pg.PlotDataItem(
            antialias=True,
            pen=pen_aps_model)

        self.legend = pg.LegendItem(offset=(0., .5))

        self.legend.setParentItem(self.plot.graphicsItem())
        self.legend.addItem(self.aps_model, '')

        self.addItem(self.aps_correlation)
        self.addItem(self.aps_model)

        self.plot.setLabels(
            bottom='Elevation (m)',
            left='Displacement (m)') 
开发者ID:pyrocko,项目名称:kite,代码行数:26,代码来源:tab_aps.py

示例3: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def __init__(self, parent_plot):
        KiteSubplot.__init__(self, parent_plot)

        self.power = pg.PlotDataItem(antialias=True)
        # self.power_lin = pg.PlotDataItem(antialias=True, pen=pen_green_dash)

        self.power.setZValue(10)
        self.plot.setLabels(
            bottom='Wavenumber (cycles/m)',
            left='Power (m<sup>2</sup>)')

        self.plot.setLogMode(x=True, y=True)

        # self.legend = pg.LegendItem(offset=(0., .5))
        # self.legend.setParentItem(self.plot.graphicsItem())
        # self.legend.addItem(self.power_lin, 'Log-linear model')

        self.addItem(self.power)
        # self.addItem(self.power_lin) 
开发者ID:pyrocko,项目名称:kite,代码行数:21,代码来源:tab_covariance.py

示例4: draw_predefined_graph

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def draw_predefined_graph(self, name):
        
        def add_context_action(ax):
            def callback(*args, **kargs):
                for item in ax.items():
                    if isinstance(item, pg.PlotDataItem):
                        if item.opts['symbol'] is None:
                            item.setData(item.xData, item.yData, symbol='s')
                        else:
                            item.setData(item.xData, item.yData, symbol=None) 
            return callback
        
        if name == 'XY_Estimation':
            graph_xy =  pg.GraphicsLayoutWidget()
            self.default_tab.addTab(graph_xy, name)
            ax = graph_xy.addPlot(row=0, col=0)
            show_marker_action = QtGui.QAction('show/hide marker', graph_xy)
            show_marker_action.triggered.connect(add_context_action(ax))
            data_index = list(list(self.data_dict.keys())).index('vehicle_local_position')
            x = self.log_data_list[data_index].data['x']
            y = self.log_data_list[data_index].data['y']
            # plot the xy trace line in red
            ax.plot(x, y, pen=(255, 0, 0)) 
开发者ID:Marxlp,项目名称:pyFlightAnalysis,代码行数:25,代码来源:analysis.py

示例5: update

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def update(self, data):
        """
        data is doubled and then every other value is set to 0.5,
        then :meth:`~pyqtgraph.PlotDataItem.curve.setData` is used with
        `connect='pairs'` to make line segments.

        Args:
            data (:class:`numpy.ndarray`): an x_width x 2 array where
                column 0 is trial number and column 1 is the value,
                where value can be "L", "C", "R" or a float.
        """
        # data should come in as an n x 2 array,
        # 0th column - trial number (x), 1st - (y) value
        data[data=="R"] = 1
        data[data=="L"] = 0
        data[data=="C"] = 0.5
        data = data.astype(np.float)

        xs = np.repeat(data[...,0],2)
        ys = np.repeat(data[...,1],2)
        ys[::2] = 0.5

        self.curve.setData(xs, ys, connect='pairs', pen='k') 
开发者ID:wehr-lab,项目名称:autopilot,代码行数:25,代码来源:plots.py

示例6: _update_ind_charts

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def _update_ind_charts(self):
        for ind, d in self.indicators:
            curve = pg.PlotDataItem(d, pen='b', antialias=True)
            ind.addItem(curve)
            ind.hideAxis('left')
            ind.showAxis('right')
            # ind.setAspectLocked(1)
            ind.setXLink(self.chart)
            ind.setLimits(
                xMin=Quotes[0].id,
                xMax=Quotes[-1].id,
                minXRange=60,
                yMin=Quotes.open.min() * 0.98,
                yMax=Quotes.open.max() * 1.02,
            )
            ind.showGrid(x=True, y=True)
            ind.setCursor(QtCore.Qt.BlankCursor) 
开发者ID:constverum,项目名称:Quantdom,代码行数:19,代码来源:charts.py

示例7: _redraw_plot

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def _redraw_plot(self):
        self._pending_refreshes-=1
        if self._pending_refreshes!=0:
            return # Another change occurred
        
        if self.plot:
            self.plot.clear()
        if self.viewbox:
            self.viewbox.close()
        
        d = self.declaration
        
        data = self._format_data()
        style = self._format_style()

        if not self.is_root and d.parent.multi_axis:
            self._refresh_multi_axis()
            self.plot = self.viewbox.addItem(pg.PlotDataItem(*data,**style))
        else:  
            self.plot = self.widget.plot(*data,**style) 
开发者ID:frmdstryr,项目名称:enamlx,代码行数:22,代码来源:qt_plot_area.py

示例8: erase

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def erase(self, item):
        """
        Erase curve in case it is drawn.

        Args:
             item (PlotDataItem): curve item associated with a data buffer to be
                erased.

        """
        index_item = self.plot_data_items_list.index(item)

        try:
            self.legend.removeItem(self._curves_names[index_item])
        except:
            pass

        if item in self.listDataItems():
            self.removeItem(item) 
开发者ID:MushroomRL,项目名称:mushroom-rl,代码行数:20,代码来源:plot_item_buffer.py

示例9: setGradientEditor

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def setGradientEditor(self, gradient_editor):
            ge = gradient_editor
            image = self.image

            hist_pen = pg.mkPen((170, 57, 57, 255), width=1.)
            image.setLookupTable(ge.getLookupTable)

            def updateLevels():
                image.setLevels(ge.region.getRegion())

            ge.sigLevelChangeFinished.connect(updateLevels)
            ge.sigLevelsChanged.connect(updateLevels)
            updateLevels()

            def updateHistogram():
                h = image.getHistogram()
                if h[0] is None:
                    return
                ge.hist_syn.setData(*h)

            ge.hist_syn = pg.PlotDataItem(pen=hist_pen)
            ge.hist_syn.rotate(90.)
            ge.vb.addItem(ge.hist_syn)
            updateHistogram()

            image.sigImageChanged.connect(updateHistogram) 
开发者ID:pyrocko,项目名称:kite,代码行数:28,代码来源:tab_covariance.py

示例10: update_ROI_graph

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def update_ROI_graph(self):
        items_to_be_removed = []
        for item in self.detail_graph.items:
            if isinstance(item, pg.PlotDataItem):
                items_to_be_removed.append(item)
                
        for item in items_to_be_removed:
            self.detail_graph.removeItem(item)
            
        items = self.main_graph_t.items
        for item in items:
            if isinstance(item, pg.PlotDataItem):
                self.detail_graph.plot(item.xData, item.yData, symbol=item.opts['symbol'], pen=item.opts['pen']) 
开发者ID:Marxlp,项目名称:pyFlightAnalysis,代码行数:15,代码来源:analysis.py

示例11: createPlotDataItem

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def createPlotDataItem(self):
        """ Creates a PyQtGraph PlotDataItem from the config values
        """
        antialias = self.antiAliasCti.configValue

        color = self.penColor
        if self.lineCti.configValue:
            pen = QtGui.QPen()
            pen.setCosmetic(True)
            pen.setColor(color)
            pen.setWidthF(self.lineWidthCti.configValue)
            pen.setStyle(self.lineStyleCti.configValue)
            shadowCti = self.lineCti.findByNodePath('shadow')
            shadowPen = shadowCti.createPen(altStyle=pen.style(), altWidth=2.0 * pen.widthF())
        else:
            pen = None
            shadowPen = None

        drawSymbols = self.symbolCti.configValue
        symbolShape = self.symbolShapeCti.configValue if drawSymbols else None
        symbolSize  = self.symbolSizeCti.configValue if drawSymbols else 0.0
        symbolPen = None # otherwise the symbols will also have dotted/solid line.
        symbolBrush = QtGui.QBrush(color) if drawSymbols else None

        plotDataItem = pg.PlotDataItem(antialias=antialias, pen=pen, shadowPen=shadowPen,
                                       symbol=symbolShape, symbolSize=symbolSize,
                                       symbolPen=symbolPen, symbolBrush=symbolBrush)
        return plotDataItem 
开发者ID:titusjan,项目名称:argos,代码行数:30,代码来源:pgctis.py

示例12: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def __init__(self, collector, parent=None):
        """ Constructor. See AbstractInspector constructor for parameters.
        """
        super(PgLinePlot1d, self).__init__(collector, parent=parent)

        # The sliced array is kept in memory. This may be different per inspector, e.g. 3D
        # inspectors may decide that this uses to much memory. The slice is therefor not stored
        # in the collector.
        self.slicedArray = None

        self.graphicsLayoutWidget = pg.GraphicsLayoutWidget()
        self.contentsLayout.addWidget(self.graphicsLayoutWidget)
        self.titleLabel = self.graphicsLayoutWidget.addLabel('<plot title goes here>', 0, 0)

        self.plotItem = ArgosPgPlotItem()
        self.viewBox = self.plotItem.getViewBox()
        self.graphicsLayoutWidget.addItem(self.plotItem, 1, 0)

        # Probe
        probePen = pg.mkPen("#BFBFBF")
        probeShadowPen = pg.mkPen("#00000064", width=3)
        self.crossLineVerShadow = pg.InfiniteLine(angle=90, movable=False, pen=probeShadowPen)
        self.crossLineVertical = pg.InfiniteLine(angle=90, movable=False, pen=probePen)
        self.probeDataItem = pg.PlotDataItem(symbolPen=probePen)
        self.probeLabel = self.graphicsLayoutWidget.addLabel('', 2, 0, justify='left')

        # Configuration tree
        self._config = PgLinePlot1dCti(pgLinePlot1d=self, nodeName='1D line plot')

        # Connect signals
        # Based mouseMoved on crosshair.py from the PyQtGraph examples directory.
        # I did not use the SignalProxy because I did not see any difference.
        self.plotItem.scene().sigMouseMoved.connect(self.mouseMoved) 
开发者ID:titusjan,项目名称:argos,代码行数:35,代码来源:lineplot1d.py

示例13: _get_chart_points

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def _get_chart_points(style):
    if style == ChartType.CANDLESTICK:
        return CandlestickItem()
    elif style == ChartType.BAR:
        return BarItem()
    return pg.PlotDataItem(Quotes.close, pen='b') 
开发者ID:constverum,项目名称:Quantdom,代码行数:8,代码来源:charts.py

示例14: _get_color

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def _get_color(ax, style, wanted_color):
    if type(wanted_color) == str:
        return wanted_color
    index = wanted_color if type(wanted_color) == int else None
    if style is None or style=='-':
        if index is None:
            index = len([i for i in ax.items if isinstance(i,pg.PlotDataItem) and not i.opts['symbol'] and not i.opts['handed_color']])
        return soft_colors[index%len(soft_colors)]
    if index is None:
        index = len([i for i in ax.items if isinstance(i,pg.PlotDataItem) and i.opts['symbol'] and not i.opts['handed_color']])
    return hard_colors[index%len(hard_colors)] 
开发者ID:highfestiva,项目名称:finplot,代码行数:13,代码来源:__init__.py

示例15: draw

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import PlotDataItem [as 别名]
def draw(self, item):
        """
        Draw curve.

        Args:
            item (PlotDataItem): curve item associated with a DataBuffer to be
                drawn.

        """
        if item not in self.listDataItems():
            self.addItem(item) 
开发者ID:MushroomRL,项目名称:mushroom-rl,代码行数:13,代码来源:plot_item_buffer.py


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