GraphItem — pyqtgraph 0.11.0rc0 documentation

# GraphItem

class `pyqtgraph.` `GraphItem`(**kwds)

  A GraphItem displays graph information as a set of nodes connected by lines (as in ‘graph theory’, not ‘graphics’). Useful for drawing networks, trees, etc.

  `__init__`(**kwds)

    Initialize self. See help(type(self)) for accurate signature.

  `boundingRect`(self) → PySide2.QtCore.QRectF
  `paint`(self, painter: PySide2.QtGui.QPainter, option: PySide2.QtWidgets.QStyleOptionGraphicsItem, widget: typing.Union[PySide2.QtWidgets.QWidget, NoneType] = None)
  `setData`(**kwds)

    Change the data displayed by the graph.

    Arguments: |
    pos | (N,2) array of the positions of each node in the graph.
    adj | (M,2) array of connection data. Each row contains indexes of two nodes that are connected.
    pen | The pen to use when drawing lines between connected nodes. May be one of: QPen a single argument to pass to pg.mkPen a record array of length M with fields (red, green, blue, alpha, width). Note that using this option may have a significant performance cost. None (to disable connection drawing) ‘default’ to use the default foreground color.
    symbolPen | The pen(s) used for drawing nodes.
    symbolBrush | The brush(es) used for drawing nodes.
    `**opts` | All other keyword arguments are given to `ScatterPlotItem.setData()` to affect the appearance of nodes (symbol, size, brush, etc.)

  `setPen`(*args, **kwargs)

    Set the pen used to draw graph lines. May be:

    - None to disable line drawing

    - Record array with fields (red, green, blue, alpha, width)

    - Any set of arguments and keyword arguments accepted by `mkPen`.

    - ‘default’ to use the default foreground color.