parameters: (figure, image, scale, vmin, vmax)
docstring: Updates the colorbar to the scale and limits given.
  
      :param figure: A matplotlib figure instance
      :param image: The matplotlib image containing the colorbar
      :param scale: The norm scale of the colorbar, this should be a matplotlib colormap norm type
      :param vmin: the minimum value on the colorbar
      :param vmax: the maximum value on the colorbar
docstring_summary: Updates the colorbar to the scale and limits given.
docstring_tokens: Updates the colorbar to the scale and limits given .
function: def update_colorbar_scale(figure, image, scale, vmin, vmax):
      """"
      Updates the colorbar to the scale and limits given.
  
      :param figure: A matplotlib figure instance
      :param image: The matplotlib image containing the colorbar
      :param scale: The norm scale of the colorbar, this should be a matplotlib colormap norm type
      :param vmin: the minimum value on the colorbar
      :param vmax: the maximum value on the colorbar
      """
      if vmin <= 0 and scale == LogNorm:
          vmin = 0.0001  # Avoid 0 log scale error
          mantid.kernel.logger.warning(
              "Scale is set to logarithmic so non-positive min value has been changed to 0.0001.")
  
      if vmax <= 0 and scale == LogNorm:
          vmax = 1  # Avoid 0 log scale error
          mantid.kernel.logger.warning("Scale is set to logarithmic so non-positive max value has been changed to 1.")
  
      image.set_norm(scale(vmin=vmin, vmax=vmax))
  
      if image.colorbar:
          label = image.colorbar._label
          image.colorbar.remove()
          locator = None
          if scale == LogNorm:
              locator = LogLocator(subs=np.arange(1, 10))
              if locator.tick_values(vmin=vmin, vmax=vmax).size == 0:
                  locator = LogLocator()
                  mantid.kernel.logger.warning("Minor ticks on colorbar scale cannot be shown "
                                               "as the range between min value and max value is too large")
          figure.subplots_adjust(wspace=0.5, hspace=0.5)
          colorbar = figure.colorbar(image, ax=figure.axes, ticks=locator, pad=0.06)
          colorbar.set_label(label)
function_tokens: def update_colorbar_scale ( figure , image , scale , vmin , vmax ) : if vmin <= 0 and scale == LogNorm : vmin = 0.0001 # Avoid 0 log scale error mantid . kernel . logger . warning ( "Scale is set to logarithmic so non-positive min value has been changed to 0.0001." ) if vmax <= 0 and scale == LogNorm : vmax = 1 # Avoid 0 log scale error mantid . kernel . logger . warning ( "Scale is set to logarithmic so non-positive max value has been changed to 1." ) image . set_norm ( scale ( vmin = vmin , vmax = vmax ) ) if image . colorbar : label = image . colorbar . _label image . colorbar . remove ( ) locator = None if scale == LogNorm : locator = LogLocator ( subs = np . arange ( 1 , 10 ) ) if locator . tick_values ( vmin = vmin , vmax = vmax ) . size == 0 : locator = LogLocator ( ) mantid . kernel . logger . warning ( "Minor ticks on colorbar scale cannot be shown " "as the range between min value and max value is too large" ) figure . subplots_adjust ( wspace = 0.5 , hspace = 0.5 ) colorbar = figure . colorbar ( image , ax = figure . axes , ticks = locator , pad = 0.06 ) colorbar . set_label ( label )