class pyqtgraph.GraphicsView(parent=None, useOpenGL=None, background='default')[source]#

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')[source]#



Optional parent widget


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 QOpenGLWidget is still an ‘experimental’ feature of Qt)


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 setConfigOptions).


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


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


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


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.


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


Return the boundaries of the view in scene coordinates