class_docstr: **Bases:** :class:`PlotItem <pyqtgraph.PlotItem>`
  
  :class:`ColorBarItem` controls the application of a 
  :ref:`color map <apiref_colormap>` to one (or more) 
  :class:`~pyqtgraph.ImageItem`. It is a simpler, compact alternative to 
  :class:`~pyqtgraph.HistogramLUTItem`, without histogram or the 
  option to adjust the colors of 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 :class:`~pyqtgraph.ImageItem` s 
  that will be displayed according to the selected color map and levels. The
  ColorBarItem can be used as a separate element in a 
  :class:`~pyqtgraph.GraphicsLayout` or added to the layout of a 
  :class:`~pyqtgraph.PlotItem` used to display image data with coordinate axes.
  
  =============================  =============================================
  **Signals:**
  sigLevelsChanged(self)         Emitted when the range sliders are moved
  sigLevelsChangeFinished(self)  Emitted when the range sliders are released
  =============================  =============================================
class_docstr_tok: ["*","*","Bases",":","*","*",":","class",":","`","PlotItem","<","pyqtgraph.PlotItem",">","`",":","class",":","`","ColorBarItem","`","controls","the","application","of","a",":","ref",":","`","color","map","<","apiref_colormap",">","`","to","one","(","or","more",")",":","class",":","`","~pyqtgraph.ImageItem","`",".","It","is","a","simpler",",","compact","alternative","to",":","class",":","`","~pyqtgraph.HistogramLUTItem","`",",","without","histogram","or","the","option","to","adjust","the","colors","of","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",":","class",":","`","~pyqtgraph.ImageItem","`","s","that","will","be","displayed","according","to","the","selected","color","map","and","levels",".","The","ColorBarItem","can","be","used","as","a","separate","element","in","a",":","class",":","`","~pyqtgraph.GraphicsLayout","`","or","added","to","the","layout","of","a",":","class",":","`","~pyqtgraph.PlotItem","`","used","to","display","image","data","with","coordinate","axes",".","=============================","=============================================","*","*","Signals",":","*","*","sigLevelsChanged","(","self",")","Emitted","when","the","range","sliders","are","moved","sigLevelsChangeFinished","(","self",")","Emitted","when","the","range","sliders","are","released","=============================","============================================="]
docstr: Sets the displayed range of image levels.
  
  Parameters
  ----------
  values: tuple of float
      Specifies levels as tuple ``(low, high)``. Either value can be `None` to leave
      the previous value unchanged. Takes precedence over `low` and `high` parameters.
  low: float
      Applies a new low level to color bar and assigned images
  high: float
      Applies a new high level to color bar and assigned images
docstr_tok: ["Sets","the","displayed","range","of","image","levels",".","Parameters","--","--","--","--","--","values",":","tuple","of","float","Specifies","levels","as","tuple","``","(","low",",","high",")","``",".","Either","value","can","be","`","None","`","to","leave","the","previous","value","unchanged",".","Takes","precedence","over","`","low","`","and","`","high","`","parameters",".","low",":","float","Applies","a","new","low","level","to","color","bar","and","assigned","images","high",":","float","Applies","a","new","high","level","to","color","bar","and","assigned","images"]
code: def setLevels(
      self, values=None, low=None, high=None, update_items=True
  ):
      """
      Sets the displayed range of image levels.
  
      Parameters
      ----------
      values: tuple of float
          Specifies levels as tuple ``(low, high)``. Either value can be `None` to leave
          the previous value unchanged. Takes precedence over `low` and `high` parameters.
      low: float
          Applies a new low level to color bar and assigned images
      high: float
          Applies a new high level to color bar and assigned images
      """
      if values is not None:  # values setting takes precendence
          low, high = values
      lo_new, hi_new = low, high
      lo_cur, hi_cur = self.values
      # allow None values to preserve original values:
      if lo_new is None:
          lo_new = lo_cur
      if hi_new is None:
          hi_new = hi_cur
      if lo_new > hi_new:  # prevent reversal
          lo_new = hi_new = (lo_new + hi_new) / 2
      # clip to limits if set:
      if self.lo_lim is not None and lo_new < self.lo_lim:
          lo_new = self.lo_lim
      if self.hi_lim is not None and hi_new > self.hi_lim:
          hi_new = self.hi_lim
      self.values = self.lo_prv, self.hi_prv = (lo_new, hi_new)
      if update_items:
          self._update_items()
      else:
          # update color bar only:
          self.axis.setRange(self.values[0], self.values[1])
  
file_path: pyqtgraph/pyqtgraph/graphicsItems/ColorBarItem.py
imports: import math
  import weakref
  import numpy
  from ..None import colormap
  from ..None import functions
  from ..Qt import QtCore, QtGui, QtWidgets
  from .LinearRegionItem import LinearRegionItem
  from .PlotItem import PlotItem
label_desc: Use image node_id 5 for calling the ColorBarItem obj's underlying member method code with example usage: obj.setLevels(values, low, high, update_items) without return types