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


Python pyqtgraph.LinearRegionItem方法代码示例

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


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

示例1: drawHistogram

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LinearRegionItem [as 别名]
def drawHistogram(self, values, xmin, xmax, bins):
        # compute the histogram
        if bins >= 50:
            bin = 51
        else:
            bin = bins+1
        y, x = np.histogram(values, bins=np.linspace(xmin, xmax, num=bin))
        # plot the chart
        if has_pyqtgraph:
            curve = pg.PlotCurveItem()
            self.plot.clear()
            curve.setData(x, y, stepMode=True, fillLevel=0, brush=(230, 230, 230), pen=pg.mkPen(None))
            self.plot.addItem(curve)
            # add the selection tool
            self.region = pg.LinearRegionItem([xmax,xmax],bounds=[xmin, xmax])
            self.region.sigRegionChangeFinished.connect(self.changedHistogramSelection)
            if self.show_lines:
                self.plot.addItem(self.region)
            # add the selection plot
            self.clearHistogramSelection()
            self.hist_selection = pg.PlotCurveItem()
            self.plot.addItem(self.hist_selection)

    # allow selection of items in chart and selecting them on the map 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:26,代码来源:AttributeCharts.py

示例2: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LinearRegionItem [as 别名]
def __init__(self, iface, plot):
        QObject.__init__(self)

        self.iface = iface
        self.plot = plot
        self.add_selection = False
        self.just_selected = False
        self.show_lines = True

        if has_pyqtgraph:
            self.plot.setClipToView(True)
            self.plot.enableAutoRange(enable=True)
            self.hist_selection = pg.PlotCurveItem()
            self.scatter_selection = []
            self.scatter = pg.ScatterPlotItem()
            self.scatter_points = {}
            self.region = pg.LinearRegionItem()
            #self.selected_points = []
            self.selected_points = pg.ScatterPlotItem()
            self.regress_line = pg.InfiniteLine()
            #self.roi = None

    #----
    # Histogram functions 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:26,代码来源:AttributeCharts.py

示例3: initMaskFunctionPlot

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LinearRegionItem [as 别名]
def initMaskFunctionPlot(self):
        self.gccPHATPlotWidget = self.createGraphicsLayoutWidget(self.backgroundColor, contentMargins=(6, 12, 18, 10))
        self.gccPHATPlotItem = self.gccPHATPlotWidget.addPlot()
        self.gccPHATPlotItem.getViewBox().setBackgroundColor((255, 255, 255, 150))
        self.gccPHATPlot = self.gccPHATPlotItem.plot()
        self.gccPHATPlot.setPen((0, 0, 0))
        self.gccPHATPlotItem.hideAxis('left')
        self.gccPHATPlotItem.hideAxis('bottom')
        self.gccPHATPlotItem.hideButtons()
        self.gccPHATPlotItem.setXRange(0, self.numTDOAs - 1)
        
        self.targetTDOARegion = pg.LinearRegionItem([self.targetTDOAIndex - self.targetTDOAEpsilon, self.targetTDOAIndex + self.targetTDOAEpsilon],
                                                    bounds=[0, self.numTDOAs - 1], movable=True)
        self.targetTDOARegion.sigRegionChangeFinished.connect(self.tdoaRegionChanged)
        
        self.targetWindowFunctionPen = pg.mkPen((0, 0, 204, 255), width=2)  # , style=QtCore.Qt.DashLine)
        self.targetWindowFunctionPlot = TargetWindowFunctionPlot(self.targetTDOARegion, self.targetModeWindowTDOASlider, self.targetModeWindowBetaSlider, self.targetModeWindowNoiseFloorSlider, self.targetModeWindowWidthSlider, self.numTDOAs, pen=self.targetWindowFunctionPen)
        self.gccPHATPlotItem.addItem(self.targetWindowFunctionPlot)
        self.targetWindowFunctionPlot.updateData() 
开发者ID:seanwood,项目名称:gcc-nmf,代码行数:21,代码来源:gccNMFInterface.py

示例4: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LinearRegionItem [as 别名]
def __init__(self, values=[0, 1], orientation=None, brush=None,
                 movable=True, bounds=None):
        pg.LinearRegionItem.__init__(self, values=values, brush=brush,
                                     orientation=orientation, movable=movable,
                                     bounds=bounds) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:7,代码来源:waveformwidget.py

示例5: setup_region

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LinearRegionItem [as 别名]
def setup_region(self):
        self.region = pg.LinearRegionItem(orientation=pg.LinearRegionItem.Horizontal)
        self.view.addItem(self.region, ignoreBounds=True)
        self.region.sigRegionChangeFinished.connect(self.region_update)
        self.region.sigRegionChanged.connect(self.region_changed)
        self.needs_region = False 
开发者ID:wapiflapi,项目名称:binglide,代码行数:8,代码来源:renderers.py

示例6: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LinearRegionItem [as 别名]
def __init__(self, X: 'hp.Dataset', parent=None):
        super(HSIDialog, self).__init__(parent)
        self.setupUi(self)
        self.setWindowTitle('View Hyperspectral Data')

        if not isinstance(X, hp.hparray):
            raise TypeError('Data needs to be passed to skhyper.process.Process first')

        self._X = X

        self.shape = None
        self.dimensions = None

        self.slider.valueChanged.connect(self.update_layer)
        self.updateImage.clicked.connect(self.update_image)
        self.updateSpectrum.clicked.connect(self.update_spectrum)
        self.Reset.clicked.connect(self.reset)

        # --- Setting image/plot settings -----------------------
        self.spec_lo = 0
        self.spec_hi = 0

        self.pgLRI = pg.LinearRegionItem()
        self.specwin.addItem(self.pgLRI)

        self.pgLRI.sigRegionChanged.connect(self.spec_region_updated)

        self.plotline = self.specwin.plot()
        # -------------------------------------------------------

        self.load_data() 
开发者ID:priyankshah7,项目名称:hypers,代码行数:33,代码来源:_hsiDialog.py

示例7: add_band

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LinearRegionItem [as 别名]
def add_band(y0, y1, color=band_color, ax=None):
    ax = _create_plot(ax=ax, maximize=False)
    lr = pg.LinearRegionItem([y0,y1], orientation=pg.LinearRegionItem.Horizontal, brush=pg.mkBrush(color), movable=False)
    lr.lines[0].setPen(pg.mkPen(None))
    lr.lines[1].setPen(pg.mkPen(None))
    lr.setZValue(-10)
    ax.addItem(lr) 
开发者ID:highfestiva,项目名称:finplot,代码行数:9,代码来源:__init__.py

示例8: add_1d_view

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LinearRegionItem [as 别名]
def add_1d_view(self):
        """
        Adds a 1d view to TimeSeriesWidget where you can plot and add items on it.
        """

        # To customize the plot axises, create new ones.
        x_axis = pg.AxisItem('bottom')  # x-axis
        x_axis.enableAutoSIPrefix(enable=False)  # Prevent automatic SI
        # prefix scaling on this axis.
        x_axis.setGrid(100)  # the alpha value of grids on x-axis

        y_axis = pg.AxisItem('left')  # x-axis
        y_axis.enableAutoSIPrefix(enable=False)  # Prevent automatic SI
        # prefix scaling on this axis.
        axis_items = {'left': y_axis, 'bottom': x_axis}

        # add plot
        self.zoom_selection = self.centralWidget.addPlot(axisItems=axis_items)

        # disable the mouse events and menu events
        self.zoom_selection.setMouseEnabled(x=False, y=False)
        self.zoom_selection.setMenuEnabled(False)

        # initialize a cursor object. Height of cursor is 20000.
        self.vline = pg.ROI(pos=[0, 0], size=[0, 20000], angle=0,
                            pen=CURSOR_PEN)
        self.zoom_selection.addItem(self.vline)  # add item to plot area

        # add y-axis region
        self.right_axis = self.centralWidget.addPlot(row=0, col=1)

        # disable the mouse events and menu events
        self.right_axis.setMouseEnabled(x=False, y=False)
        self.right_axis.setMenuEnabled(False)

        self.right_axis.setMaximumWidth(125)  # maximum width 125
        self.right_axis.setContentsMargins(0, 0, 0, 40)  # set 40 left margin

        self.right_axis.hideAxis(axis="left")  # hide left-axis
        self.right_axis.hideAxis(axis="bottom")  # hide botton-axis
        self.right_axis.setYRange(0, 20000, padding=0)
        # show right axis
        self.right_axis.setLabel(axis="right", text="Frequency (Hz)")

        # initialize a linear region item
        orientation = pg.LinearRegionItem.Horizontal  # set the item horizontal
        self.region_yaxis = pg.LinearRegionItem(values=[0, 20000],
                                                brush=YAXIS_BRUSH,
                                                orientation=orientation,
                                                bounds=[0, 20000])
        self.right_axis.addItem(self.region_yaxis)  # add item to right axis

        # set region changed signal to set y axis range in the plot
        self.region_yaxis.sigRegionChangeFinished.connect(
            self.change_yaxis_range) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:57,代码来源:timeserieswidget.py

示例9: plot_trace

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import LinearRegionItem [as 别名]
def plot_trace(self):
    event_time = self.filtered_catalog.utc_timestamp.values[self.event_idx]
    self.statusBar.showMessage('Event {} of {}: {}'.format(
      self.event_idx+1, self.num_events, utc.UTCDateTime(event_time)))

    window_sz = 20 # in sec
    utc_time = utc.UTCDateTime(event_time)
    start = utc_time
    end = utc_time+window_sz
    local_stream = self.stream.slice(start, end)
    local_stream.filter('highpass', freq=2.0)

    sample_rate = local_stream[0].stats.sampling_rate
    npts = local_stream[0].stats.npts

    event_sample = (utc_time-start)*sample_rate

    n_traces = len(local_stream)
    n_samples = len(local_stream[0].data)
    data = np.zeros((n_traces, n_samples), dtype=np.float32)
    for i in range(n_traces):
        data[i, :] = local_stream[i].data[...]
        mean = np.mean(data[i, :])
        data[i, :] -= mean

    self.trace_x.clear()
    self.trace_y.clear()
    self.trace_z.clear()

    self.trace_x.plot(data[0, :], pen=(255,120,120,200))
    self.trace_y.plot(data[1, :], pen=(120,255,120,200))
    self.trace_z.plot(data[2, :], pen=(120,120,255,200))

    self.lrx = pg.LinearRegionItem([event_sample,event_sample+sample_rate*1])
    self.lrx.setZValue(-10)
    self.trace_x.addItem(self.lrx)

    # lry = pg.LinearRegionItem([400,700])
    # lry.setZValue(-10)
    # self.trace_y.addItem(lry)
    #
    # lrz = pg.LinearRegionItem([400,700])
    # lrz.setZValue(-10)
    # self.trace_z.addItem(lrz)
    #
    # regions = [lrx, lry, lrz]
    #
    # def updateRange(lr, regions):
    #   for l in regions:
    #     if l != lr:
    #       l.setRegion(lr.getRegion())
    #
    # # for l in regions:
    # lrx.sigRegionChanged.connect(lambda : updateRange(lrx, regions))
    # lry.sigRegionChanged.connect(lambda : updateRange(lry, regions))
    # lrz.sigRegionChanged.connect(lambda : updateRange(lrz, regions)) 
开发者ID:tperol,项目名称:ConvNetQuake,代码行数:58,代码来源:label_events.py


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