parameters: (self, **kwargs)
docstring: Apply setting to create a colorbar.
  
          Inputs:
              see ChiggerResult
docstring_summary: Apply setting to create a colorbar.
docstring_tokens: Apply setting to create a colorbar .
function: def update(self, **kwargs):
          """
          Apply setting to create a colorbar.
  
          Inputs:
              see ChiggerResult
          """
  
          # Set the options provided
          self.setOptions(**kwargs)
          if self.needsInitialize():
              self.initialize()
  
          # Convenience names for the various sources
          plane, axis0, axis1 = self._sources
  
          # Origin
          loc = self.getOption('location').lower()
          if not self.isOptionValid('colorbar_origin'):
              if (loc == 'right') or (loc == 'left'):
                  self.setOption('colorbar_origin', [0.8, 0.25, 0.0])
              else:
                  self.setOption('colorbar_origin', [0.25, 0.2, 0.0])
  
          # Get dimensions of colorbar, taking into account the orientation
          n = self.getOption('cmap_num_colors')
          length0 = 0
          length1 = 0
          loc = self.getOption('location')
          if (loc == 'right') or (loc == 'left'):
              length0 = self.getOption('width')
              length1 = self.getOption('length')
              plane.setOptions(resolution=[1, n+1])
          else:
              length0 = self.getOption('length')
              length1 = self.getOption('width')
              plane.setOptions(resolution=[n+1, 1])
  
          # Coordinate system transformation object
          pos = self.getOption('colorbar_origin')
          coord = vtk.vtkCoordinate()
          coord.SetCoordinateSystemToNormalizedViewport()
  
          # The viewport must be set, before the points are computed.
          if self.isOptionValid('viewport'):
              self._vtkrenderer.SetViewport(self.getOption('viewport'))
  
          # Point 0
          coord.SetViewport(self._vtkrenderer)
          coord.SetValue(pos[0]+length0, pos[1], 0)
          p0 = coord.GetComputedViewportValue(self._vtkrenderer)
  
          # Point 1
          coord.SetValue(pos[0], pos[1]+length1, 0)
          p1 = coord.GetComputedViewportValue(self._vtkrenderer)
  
          coord.SetValue(*pos)
          pos = coord.GetComputedViewportValue(self._vtkrenderer)
  
          # Update the bar position
          plane.setOptions(origin=[pos[0], pos[1], 0],
                           point1=[p0[0], p0[1], 0],
                           point2=[p1[0], p1[1], 0])
  
          # Set the colormap for the bar
          rng = self.getOption('cmap_range')
          step = (rng[1] - rng[0]) / float(n)
  
          data = vtk.vtkFloatArray()
          data.SetNumberOfTuples(n+1)
          for i in range(n+1):
              data.SetValue(i, rng[0] + i*step)
          plane.setOptions(data=data)
  
          # Setup the primary Axis
          axis0.options().update(self.getOption('primary'))
          location = self.__setAxisPosition(axis0, p0, p1, self.getOption('location'))
  
          # Setup the secondary Axis
          axis1.options().update(self.getOption('secondary'))
          self.__setAxisPosition(axis1, p0, p1, location)
  
          # Call base class method
          super(ColorBar, self).update()
function_tokens: def update ( self , * * kwargs ) : # Set the options provided self . setOptions ( * * kwargs ) if self . needsInitialize ( ) : self . initialize ( ) # Convenience names for the various sources plane , axis0 , axis1 = self . _sources # Origin loc = self . getOption ( 'location' ) . lower ( ) if not self . isOptionValid ( 'colorbar_origin' ) : if ( loc == 'right' ) or ( loc == 'left' ) : self . setOption ( 'colorbar_origin' , [ 0.8 , 0.25 , 0.0 ] ) else : self . setOption ( 'colorbar_origin' , [ 0.25 , 0.2 , 0.0 ] ) # Get dimensions of colorbar, taking into account the orientation n = self . getOption ( 'cmap_num_colors' ) length0 = 0 length1 = 0 loc = self . getOption ( 'location' ) if ( loc == 'right' ) or ( loc == 'left' ) : length0 = self . getOption ( 'width' ) length1 = self . getOption ( 'length' ) plane . setOptions ( resolution = [ 1 , n + 1 ] ) else : length0 = self . getOption ( 'length' ) length1 = self . getOption ( 'width' ) plane . setOptions ( resolution = [ n + 1 , 1 ] ) # Coordinate system transformation object pos = self . getOption ( 'colorbar_origin' ) coord = vtk . vtkCoordinate ( ) coord . SetCoordinateSystemToNormalizedViewport ( ) # The viewport must be set, before the points are computed. if self . isOptionValid ( 'viewport' ) : self . _vtkrenderer . SetViewport ( self . getOption ( 'viewport' ) ) # Point 0 coord . SetViewport ( self . _vtkrenderer ) coord . SetValue ( pos [ 0 ] + length0 , pos [ 1 ] , 0 ) p0 = coord . GetComputedViewportValue ( self . _vtkrenderer ) # Point 1 coord . SetValue ( pos [ 0 ] , pos [ 1 ] + length1 , 0 ) p1 = coord . GetComputedViewportValue ( self . _vtkrenderer ) coord . SetValue ( * pos ) pos = coord . GetComputedViewportValue ( self . _vtkrenderer ) # Update the bar position plane . setOptions ( origin = [ pos [ 0 ] , pos [ 1 ] , 0 ] , point1 = [ p0 [ 0 ] , p0 [ 1 ] , 0 ] , point2 = [ p1 [ 0 ] , p1 [ 1 ] , 0 ] ) # Set the colormap for the bar rng = self . getOption ( 'cmap_range' ) step = ( rng [ 1 ] - rng [ 0 ] ) / float ( n ) data = vtk . vtkFloatArray ( ) data . SetNumberOfTuples ( n + 1 ) for i in range ( n + 1 ) : data . SetValue ( i , rng [ 0 ] + i * step ) plane . setOptions ( data = data ) # Setup the primary Axis axis0 . options ( ) . update ( self . getOption ( 'primary' ) ) location = self . __setAxisPosition ( axis0 , p0 , p1 , self . getOption ( 'location' ) ) # Setup the secondary Axis axis1 . options ( ) . update ( self . getOption ( 'secondary' ) ) self . __setAxisPosition ( axis1 , p0 , p1 , location ) # Call base class method super ( ColorBar , self ) . update ( )