GLGraphItem#
- class pyqtgraph.opengl.GLGraphItem(parentItem=None, **kwds)[source]#
A GLGraphItem displays graph information as a set of nodes connected by lines (as in ‘graph theory’, not ‘graphics’). Useful for drawing networks, trees, etc.
- setData(**kwds)[source]#
Change the data displayed by the graph.
- Parameters:
edges (
numpy.ndarray
) – 2D array of shape (M, 2) of connection data, each row contains indexes of two nodes that are connected. Dtype must be integer or unsigned.edgeColor (
pyqtgraph.mkColor()
, optional) – The color to draw edges. Accepts the same arguments asmkColor()
. If None, no edges will be drawn. Default is (1.0, 1.0, 1.0, 0.5).edgeWidth (
float
, optional) – Value specifying edge width. Default is 1.0nodePositions (
numpy.ndarray
) – 2D array of shape (N, 3), where each row represents the x, y, z coordinates for each nodenodeColor (
numpy.ndarray
orfloat
orpyqtgraph.mkColor()
, optional) – 2D array of shape (N, 4) of dtype float32, where each row represents the R, G, B, A values in range of 0-1, or for the same color for all nodes, provide either QColor type or input formkColor()
nodeSize (
numpy.ndarray
orfloat
orint
) – Either 2D numpy array of shape (N, 1) where each row represents the size of each node, or if a scalar, apply the same size to all nodes**kwds – All other keyword arguments are given to
GLScatterPlotItem.setData()
to affect the appearance of nodes (pos, color, size, pxMode, etc.)
- Raises:
TypeError – When dtype of edges dtype is not unisnged or integer dtype