GridItem#

class pyqtgraph.GridItem(pen='default', textPen='default')[source]#

Bases: UIGraphicsItem

Displays a rectangular grid of lines indicating major divisions within a coordinate system. Automatically determines what divisions to use.

__init__(pen='default', textPen='default')[source]#
setPen(*args, **kwargs)[source]#

Set the pen used to draw the grid.

setTextPen(*args, **kwargs)[source]#

Set the pen used to draw the texts.

setTickSpacing(x=None, y=None)[source]#

Set the grid tick spacing to use.

Tick spacing for each axis shall be specified as an array of descending values, one for each tick scale. When the value is set to None, grid line distance is chosen automatically for this particular level.

Example

Default setting of 3 scales for each axis: setTickSpacing(x=[None, None, None], y=[None, None, None])

Single scale with distance of 1.0 for X axis, Two automatic scales for Y axis: setTickSpacing(x=[1.0], y=[None, None])

Single scale with distance of 1.0 for X axis, Two scales for Y axis, one with spacing of 1.0, other one automatic: setTickSpacing(x=[1.0], y=[1.0, None])