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


Python pyqtgraph.ViewBox方法代码示例

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


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

示例1: newColorbar

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def newColorbar(view, left, top, impixpervoxx, impixpervoxy, imgsize):
    cb_xdim = imgsize // 10
    cb_ydim = imgsize
    theviewbox = pg.ViewBox(enableMouse=False)
    theviewbox.setRange(QtCore.QRectF(0, 0, cb_xdim, cb_ydim),
                        xRange=(0, cb_xdim - 1), yRange=(0, cb_ydim - 1), padding=0.0,
                        disableAutoRange=True)
    theviewbox.setAspectLocked()

    thecolorbarwin = pg.ImageItem()
    theviewbox.addItem(thecolorbarwin)
    thecolorbarwin.translate(left, top)
    thecolorbarwin.scale(impixpervoxx, impixpervoxy)

    colorbarvals = np.zeros((cb_xdim, cb_ydim), dtype=np.float64)
    for i in range(0, cb_ydim):
        colorbarvals[:, i] = i * (1.0 / (cb_ydim - 1.0))
    thecolorbarwin.setImage(colorbarvals, levels=[0.0, 1.0])
    return thecolorbarwin, theviewbox 
开发者ID:bbfrederick,项目名称:rapidtide,代码行数:21,代码来源:OrthoImageItem.py

示例2: _updateTargetFromNode

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def _updateTargetFromNode(self):
        """ Applies the configuration to the target axis.
        """
        if not self.autoRangeCti or not self.autoRangeCti.configValue:
            padding = 0
        elif self.paddingCti.configValue == -1: # specialValueText
            # PyQtGraph dynamic padding: between 0.02 and 0.1 dep. on the size of the ViewBox
            padding = None
        else:
            padding = self.paddingCti.configValue / 100

        targetRange = self.calculateRange()
        #logger.debug("axisRange: {}, padding={}".format(targetRange, padding))
        if not np.all(np.isfinite(targetRange)):
            logger.warn("New target range is not finite. Plot range not updated")
            return

        self.setTargetRange(targetRange, padding=padding) 
开发者ID:titusjan,项目名称:argos,代码行数:20,代码来源:pgctis.py

示例3: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def __init__(self, parent=None, border=None, lockAspect=False, enableMouse=True,
                 invertY=False, enableMenu=True, name=None, invertX=False):
        #pg.ViewBox.__init__(self, border, lockAspect, enableMouse,
                            #invertY, enableMenu, name, invertX)
        super(ViewBox, self).__init__()
        self.border = fn.mkPen(border)
        if enableMenu:
            self.menu = ViewBoxMenu(self)
        self.name = name
        self.parent=parent
        if self.name=="plot2":
            self.setXLink(parent.p1)
            self.setYLink(parent.p1)

        # set state
        self.state['enableMenu'] = enableMenu
        self.state['yInverted'] = invertY 
开发者ID:MouseLand,项目名称:suite2p,代码行数:19,代码来源:graphics.py

示例4: _init_line

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def _init_line(self) -> None:
        """
        Create line objects.
        """
        self._v_lines: Dict[str, pg.InfiniteLine] = {}
        self._h_lines: Dict[str, pg.InfiniteLine] = {}
        self._views: Dict[str, pg.ViewBox] = {}

        pen = pg.mkPen(WHITE_COLOR)

        for plot_name, plot in self._plots.items():
            v_line = pg.InfiniteLine(angle=90, movable=False, pen=pen)
            h_line = pg.InfiniteLine(angle=0, movable=False, pen=pen)
            view = plot.getViewBox()

            for line in [v_line, h_line]:
                line.setZValue(0)
                line.hide()
                view.addItem(line)

            self._v_lines[plot_name] = v_line
            self._h_lines[plot_name] = h_line
            self._views[plot_name] = view 
开发者ID:nicai0609,项目名称:Python-CTPAPI,代码行数:25,代码来源:candle_demo.py

示例5: mouseDragEvent

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def mouseDragEvent(self, ev, axis=None):
        # if ev.start==True and ev.finish==False: ##判断拖拽事件是否结束
        pos = ev.pos()
        lastPos = ev.lastPos()
        dif = pos - lastPos

        rect = self.sceneBoundingRect()

        pianyi = dif.x() * self.parent.count * 2 / rect.width()

        self.parent.index -= int(pianyi)
        self.parent.index = max(self.parent.index, 60)
        xMax = self.parent.index + self.parent.count
        xMin = self.parent.index - self.parent.count
        # if xMin < 0:
        #     xMin = 0

        pg.ViewBox.mouseDragEvent(self, ev, axis) 
开发者ID:epolestar,项目名称:equant,代码行数:20,代码来源:fundtab.py

示例6: makePI

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def makePI(self, name):
        """生成PlotItem对象"""
        vb = CustomViewBox(self)
        plotItem = pg.PlotItem(viewBox=vb, name=name, axisItems={'bottom': self.axisTime})
        plotItem.setMenuEnabled(False)
        # 仅绘制ViewBox可见范围内的点
        plotItem.setClipToView(True)
        plotItem.hideAxis('left')
        plotItem.showAxis('right')
        # 设置采样模式
        plotItem.setDownsampling(mode='peak')
        plotItem.setRange(xRange=(0, 1), yRange=(0, 1))
        plotItem.getAxis('right').setWidth(70)
        plotItem.getAxis('right').setStyle(tickFont=QtGui.QFont('Roman times', 10, QtGui.QFont.Bold))
        plotItem.getAxis('right').setPen(color=(255, 255, 255, 255), width=0.8)
        plotItem.showGrid(True, True)
        plotItem.hideButtons()

        return plotItem 
开发者ID:epolestar,项目名称:equant,代码行数:21,代码来源:fundtab.py

示例7: makePI

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def makePI(self, name):
        """生成PlotItem对象"""
        vb = CustomViewBox(self)
        plotItem = pg.PlotItem(viewBox=vb, name=name, axisItems={'bottom': self.axisTime})
        plotItem.setMenuEnabled(False)
        # 仅绘制ViewBox可见范围内的点
        plotItem.setClipToView(True)
        plotItem.showAxis('left')
        # 设置采样模式
        plotItem.setDownsampling(mode='peak')
        plotItem.setRange(xRange=(0, 1), yRange=(0, 1))
        plotItem.getAxis('left').setWidth(70)
        plotItem.getAxis('left').setStyle(tickFont=QtGui.QFont('Roman times', 10, QtGui.QFont.Bold))
        plotItem.getAxis('left').setPen(color=(255, 255, 255, 255), width=0.8)
        plotItem.showGrid(True, True)
        plotItem.hideButtons()

        return plotItem 
开发者ID:epolestar,项目名称:equant,代码行数:20,代码来源:graphtab.py

示例8: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def __init__(self, *args, **kwds):
        pg.ViewBox.__init__(self, *args, **kwds)
        # 拖动放大模式
        #self.setMouseMode(self.RectMode)
        
    ## 右键自适应
    #---------------------------------------------------------------------- 
开发者ID:rjj510,项目名称:uiKLine,代码行数:9,代码来源:uiKLine.py

示例9: updateViews

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def updateViews():
    ## view has resized; update auxiliary views to match
    global p1, p2, p3
    p2.setGeometry(p1.vb.sceneBoundingRect())
    p3.setGeometry(p1.vb.sceneBoundingRect())
    
    ## need to re-update linked axes since this was called
    ## incorrectly while views had different shapes.
    ## (probably this should be handled in ViewBox.resizeEvent)
    p2.linkedViewChanged(p1.vb, p2.XAxis)
    p3.linkedViewChanged(p1.vb, p3.XAxis) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:13,代码来源:MultiplePlotAxes.py

示例10: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def __init__(self, *args, **kwds):
        pg.ViewBox.__init__(self, *args, **kwds)
        self.setMouseMode(self.RectMode)
        
    ## reimplement right-click to zoom out 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:7,代码来源:customPlot.py

示例11: mouseDragEvent

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def mouseDragEvent(self, ev):
        if ev.button() == QtCore.Qt.RightButton:
            ev.ignore()
        else:
            pg.ViewBox.mouseDragEvent(self, ev) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:7,代码来源:customPlot.py

示例12: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def __init__(self, *args, **kwds):
        pg.ViewBox.__init__(self, *args, **kwds)
        #~ self.disableAutoRange() 
开发者ID:tridesclous,项目名称:tridesclous,代码行数:5,代码来源:traceviewer.py

示例13: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def __init__(self, *args, **kwds):
        pg.ViewBox.__init__(self, *args, **kwds)
        self.disableAutoRange()
        self.drag_points = [] 
开发者ID:tridesclous,项目名称:tridesclous,代码行数:6,代码来源:ndscatter.py

示例14: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def __init__(self, acc, n_points=300):
        super().__init__()
        self.title = "Tail curvature"
        self.acc = acc
        self.headers = None
        self.n_points = n_points

        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.display_widget = pg.GraphicsLayoutWidget()
        self.vb_display = pg.ViewBox()
        self.display_widget.addItem(self.vb_display)
        self.image_item = pg.ImageItem()
        self.vb_display.addItem(self.image_item)

        self.image_item.setLevels((-0.6, 0.6))
        self.image_item.setLookupTable(
            pg.ColorMap(
                np.linspace(0, 1, 5),
                np.array(
                    [
                        [0.42107294, 0.80737975, 0.49219722],
                        [0.23166242, 0.39962101, 0.32100403],
                        [0.0, 0.0, 0.0],
                        [0.46170494, 0.30327584, 0.38740225],
                        [0.91677407, 0.58427975, 0.92293321],
                    ]
                ),
            ).getLookupTable(alpha=False)
        )
        self.layout().addWidget(self.display_widget) 
开发者ID:portugueslab,项目名称:stytra,代码行数:34,代码来源:fishplots.py

示例15: __init__

# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import ViewBox [as 别名]
def __init__(self, viewBox, axisNumber, autoRangeFunctions=None,
                 nodeName='range', expanded=True):
        """ Constructor.
            The target axis is specified by viewBox and axisNumber (0 for x-axis, 1 for y-axis)

            If given, autoRangeFunctions must be a (label to function) dictionary that will be used
            to populate the (auto range) method ChoiceCti. If not give, the there will not be
            a method choice and the autorange implemented by PyQtGraph will be used.
        """
        if autoRangeFunctions is None:
            autoRangeFunctions = {self.PYQT_RANGE: partial(viewBoxAxisRange, viewBox, axisNumber)}

        super(PgAxisRangeCti, self).__init__(autoRangeFunctions=autoRangeFunctions,
                                             nodeName=nodeName, expanded=expanded)
        check_class(viewBox, pg.ViewBox)
        assert axisNumber in (X_AXIS, Y_AXIS), "axisNumber must be 0 or 1"

        self.viewBox = viewBox
        self.axisNumber = axisNumber

        # Autorange must be disabled as not to interfere with this class.
        # Note that autorange of ArgosPgPlotItem is set to False by default.
        axisAutoRange = self.viewBox.autoRangeEnabled()[axisNumber]
        assert axisAutoRange is False, \
            "Autorange is {!r} for axis {} of {}".format(axisAutoRange, axisNumber, self.nodePath)

        # Connect signals
        self.viewBox.sigRangeChangedManually.connect(self.setAutoRangeOff)
        self.viewBox.sigRangeChanged.connect(self.refreshMinMax) 
开发者ID:titusjan,项目名称:argos,代码行数:31,代码来源:pgctis.py


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