GraphicsLayout#

class pyqtgraph.GraphicsLayout(
parent=None,
border=None,
)[source]#

Used for laying out GraphicsWidgets in a grid. This is usually created automatically as part of a GraphicsLayoutWidget.

__init__(
parent=None,
border=None,
)[source]#
addItem(
item,
row=None,
col=None,
rowspan=1,
colspan=1,
)[source]#

Add an item to the layout and place it in the next available cell (or in the cell specified). The item must be an instance of a QGraphicsWidget subclass.

addLabel(
text=' ',
row=None,
col=None,
rowspan=1,
colspan=1,
**kargs,
)[source]#

Create a LabelItem with text and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to LabelItem.__init__ Returns the created item.

To create a vertical label, use angle = -90.

addLayout(
row=None,
col=None,
rowspan=1,
colspan=1,
**kargs,
)[source]#

Create an empty GraphicsLayout and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to GraphicsLayout.__init__ Returns the created item.

addPlot(
row=None,
col=None,
rowspan=1,
colspan=1,
**kargs,
)[source]#

Create a PlotItem and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to PlotItem.__init__ Returns the created item.

addViewBox(
row=None,
col=None,
rowspan=1,
colspan=1,
**kargs,
)[source]#

Create a ViewBox and place it in the next available cell (or in the cell specified) All extra keyword arguments are passed to ViewBox.__init__ Returns the created item.

clear()[source]#

Remove all items from the layout and set the current row and column to 0

getItem(
row,
col,
)[source]#

Return the item in (row, col). If the cell is empty, return None.

itemIndex(
item,
)[source]#

Return the numerical index of GraphicsItem object passed in

Parameters:

item (QGraphicsLayoutItem) – Item to query the index position of

Returns:

Index of the item within the graphics layout

Return type:

int

Raises:

ValueError – Raised if item could not be found inside the GraphicsLayout instance.

nextCol(
*args,
**kargs,
)[source]#

Alias of nextColumn

nextColumn()[source]#

Advance to next available column (generally only for internal use–called by addItem)

nextRow()[source]#

Advance to next row for automatic item placement

removeItem(
item,
)[source]#

Remove item from the layout.

setBorder(
*args,
**kwds,
)[source]#

Set the pen used to draw border between cells.

See mkPen for arguments.