- class pyqtgraph.ColorBarItem(values=(0, 1), width=25, colorMap=None, label=None, interactive=True, limits=None, rounding=1, orientation='vertical', pen='w', hoverPen='r', hoverBrush='#FF000080', cmap=None)¶
ColorBarItem is a simpler, compact alternative to HistogramLUTItem, without histogram or the option to adjust the look-up table.
A labeled axis is displayed directly next to the gradient to help identify values. Handles included in the color bar allow for interactive adjustment.
A ColorBarItem can be assigned one or more ImageItems that will be displayed according to the selected color map and levels. The ColorBarItem can be used as a separate element in a GraphicsLayout or added to the layout of a PlotItem used to display image data with coordinate axes.
Emitted when the range sliders are moved
Emitted when the range sliders are released
- __init__(values=(0, 1), width=25, colorMap=None, label=None, interactive=True, limits=None, rounding=1, orientation='vertical', pen='w', hoverPen='r', hoverBrush='#FF000080', cmap=None)¶
Creates a new ColorBarItem.
The range of values as tuple (min, max)
(default=25) The width of the displayed color bar
ColorMap object, look-up table is also applied to assigned ImageItem(s)
(default=None) Label applied to color bar axis
(default=True) Handles are displayed to interactively adjust level range
Limits to adjustment range as (low, high) tuple, None disables limit
(default=1) Adjusted range values are rounded to multiples of this values
(default=’vertical’) ‘horizontal’ or ‘h’ gives a horizontal color bar.
color of adjustement handles in interactive mode
color of adjustement handles when hovered over
color of movable center region when hovered over
Returns the assigned ColorMap object.
returns the currently set levels as the tuple (low, high).
Sets a ColorMap object to determine the ColorBarItem’s look-up table. The same look-up table is applied to any assigned ImageItem.
- setImageItem(img, insert_in=None)¶
assign ImageItem or list of ImageItems to be controlled
ImageItem or list of [ImageItem, ImageItem, …] that will be set to the color map of the ColorBarItem. In interactive mode, the levels of all assigned ImageItems will be controlled simultaneously.
If a PlotItem is given, the color bar is inserted on the right or bottom of the plot
- setLevels(values=None, low=None, high=None)¶
Sets the displayed range of levels as specified.
specifies levels as tuple (low, high). Either value can be None to leave to previous value unchanged. Takes precedence over low and high parameters.
new low level to be applied to color bar and assigned images
new high level to be applied to color bar and assigned images