GraphicsView — pyqtgraph 0.9.8 documentation

### Navigation

- index
- modules |
- next |
- previous |
- pyqtgraph 0.9.8 documentation »
- API Reference »
- Pyqtgraph’s Widgets »

# GraphicsView

class `pyqtgraph.` `GraphicsView`(parent=None, useOpenGL=None, background='default')

  Re-implementation of QGraphicsView that removes scrollbars and allows unambiguous control of the viewed coordinate range. Also automatically creates a GraphicsScene and a central QGraphicsWidget that is automatically scaled to the full view geometry.

  This widget is the basis for `PlotWidget`, `GraphicsLayoutWidget`, and the view widget in `ImageView`.

  By default, the view coordinate system matches the widget’s pixel coordinates and automatically updates when the view is resized. This can be overridden by setting autoPixelRange=False. The exact visible range can be set with setRange().

  The view can be panned using the middle mouse button and scaled using the right mouse button if enabled via enableMouse() (but ordinarily, we use ViewBox for this functionality).

  `__init__`(parent=None, useOpenGL=None, background='default')

    Arguments: |
    parent | Optional parent widget
    useOpenGL | If True, the GraphicsView will use OpenGL to do all of its rendering. This can improve performance on some systems, but may also introduce bugs (the combination of QGraphicsView and QGLWidget is still an ‘experimental’ feature of Qt)
    background | Set the background color of the GraphicsView. Accepts any single argument accepted by `mkColor`. By default, the background color is determined using the ‘backgroundColor’ configuration option (see `setConfigOption`.

  `pixelSize`()

    Return vector with the length and width of one view pixel in scene coordinates

  `scaleToImage`(image)

    Scales such that pixels in image are the same size as screen pixels. This may result in a significant performance increase.

  `setAntialiasing`(aa)

    Enable or disable default antialiasing. Note that this will only affect items that do not specify their own antialiasing options.

  `setBackground`(background)

    Set the background color of the GraphicsView. To use the defaults specified py pyqtgraph.setConfigOption, use background=’default’. To make the background transparent, use background=None.

  `setCentralWidget`(item)

    Sets a QGraphicsWidget to automatically fill the entire view (the item will be automatically resize whenever the GraphicsView is resized).

  `viewRect`()

    Return the boundaries of the view in scene coordinates

### Navigation

- index
- modules |
- next |
- previous |
- pyqtgraph 0.9.8 documentation »
- API Reference »
- Pyqtgraph’s Widgets »