ViewBox

class pyqtgraph.ViewBox(parent=None, border=None, lockAspect=False, enableMouse=True, invertY=False)

Box that allows internal scaling/panning of children by mouse drag. Not really compatible with GraphicsView having the same functionality.

__init__(parent=None, border=None, lockAspect=False, enableMouse=True, invertY=False)
childTransform()

Return the transform that maps from child(item in the childGroup) coordinates to local coordinates. (This maps from inside the viewbox to outside)

childrenBoundingRect(item=None)

Return the bounding rect of all children. Returns None if there are no bounded children

itemBoundingRect(item)

Return the bounding rect of the item in view coordinates

keyPressEvent(ev)

This routine should capture key presses in the current view box. Key presses are used only when self.useLeftButtonPan is false The following events are implemented: ctrl-A : zooms out to the default “full” view of the plot ctrl-+ : moves forward in the zooming stack (if it exists) ctrl– : moves backward in the zooming stack (if it exists)

mapFromView(obj)

Maps from the coordinate system displayed inside the ViewBox to the local coordinates of the ViewBox

mapSceneToView(obj)

Maps from scene coordinates to the coordinate system displayed inside the ViewBox

mapToView(obj)

Maps from the local coordinates of the ViewBox to the coordinate system displayed inside the ViewBox

mapViewToScene(obj)

Maps from the coordinate system displayed inside the ViewBox to scene coordinates

scaleBy(s, center=None)

Scale by s around given center point (or center of view)

setAspectLocked(lock=True, ratio=1)

If the aspect ratio is locked, view scaling is always forced to be isotropic. By default, the ratio is set to 1; x and y both have the same scaling. This ratio can be overridden (width/height), or use None to lock in the current ratio.

setRange(ax, minimum=None, maximum=None, padding=0.02, update=True)

Set the visible range of the ViewBox. Can be called with a QRectF:

setRange(QRectF(x, y, w, h))
Or with axis, min, max:
setRange(0, xMin, xMax) setRange(1, yMin, yMax)
targetRect()

Return the region which has been requested to be visible. (this is not necessarily the same as the region that is actually visible)

viewRect()

Return a QRectF bounding the region visible within the ViewBox

Previous topic

ImageItem

Next topic

LinearRegionItem

This Page