original_docstring: Internal function for setting colormap and colorbar limits.
  
      Used by for plot_stat_map and plot_glass_brain.
  
      The limits for the colormap will always be set to range from -vmax to vmax.
      The limits for the colorbar depend on the symmetric_cbar argument, please
      refer to docstring of plot_stat_map.
  
      
docstring: Internal function for setting colormap and colorbar limits.
  
  The limits for the colormap will always be set to range from -vmax to vmax.
  The limits for the colorbar depend on the symmetric_cbar argument, please
  refer to docstring of plot_stat_map.
docstring_tokens: Internal function for setting colormap and colorbar limits . The limits for the colormap will always be set to range from - vmax to vmax . The limits for the colorbar depend on the symmetric_cbar argument please refer to docstring of plot_stat_map .
code: def _get_colorbar_and_data_ranges(stat_map_data, vmax, symmetric_cbar, kwargs,
                                    force_min_stat_map_value=None):
      """Internal function for setting colormap and colorbar limits.
  
      Used by for plot_stat_map and plot_glass_brain.
  
      The limits for the colormap will always be set to range from -vmax to vmax.
      The limits for the colorbar depend on the symmetric_cbar argument, please
      refer to docstring of plot_stat_map.
  
      """
      if 'vmin' in kwargs:
          raise ValueError('this function does not accept a "vmin" '
                           'argument, as it uses a symmetrical range '
                           'defined via the vmax argument. To threshold '
                           'the plotted map, use the "threshold" argument')
  
      # make sure that the color range is symmetrical
      if vmax is None or symmetric_cbar in ['auto', False]:
          # Avoid dealing with masked_array:
          if hasattr(stat_map_data, '_mask'):
              stat_map_data = np.asarray(
                  stat_map_data[np.logical_not(stat_map_data._mask)])
          stat_map_max = np.nanmax(stat_map_data)
          if force_min_stat_map_value is None:
              stat_map_min = np.nanmin(stat_map_data)
          else:
              stat_map_min = force_min_stat_map_value
  
      if symmetric_cbar == 'auto':
          symmetric_cbar = stat_map_min < 0 and stat_map_max > 0
  
      if vmax is None:
          vmax = max(-stat_map_min, stat_map_max)
      vmin = -vmax
  
      if not symmetric_cbar:
          negative_range = stat_map_max <= 0
          positive_range = stat_map_min >= 0
          if positive_range:
              cbar_vmin = 0
              cbar_vmax = None
          elif negative_range:
              cbar_vmax = 0
              cbar_vmin = None
          else:
              cbar_vmin = stat_map_min
              cbar_vmax = stat_map_max
      else:
          cbar_vmin, cbar_vmax = None, None
      return cbar_vmin, cbar_vmax, vmin, vmax
code_tokens: def _get_colorbar_and_data_ranges ( stat_map_data , vmax , symmetric_cbar , kwargs , force_min_stat_map_value = None ) : if 'vmin' in kwargs : raise ValueError ( 'this function does not accept a "vmin" ' 'argument, as it uses a symmetrical range ' 'defined via the vmax argument. To threshold ' 'the plotted map, use the "threshold" argument' ) if vmax is None or symmetric_cbar in [ 'auto' , False ] : if hasattr ( stat_map_data , '_mask' ) : stat_map_data = np . asarray ( stat_map_data [ np . logical_not ( stat_map_data . _mask ) ] ) stat_map_max = np . nanmax ( stat_map_data ) if force_min_stat_map_value is None : stat_map_min = np . nanmin ( stat_map_data ) else : stat_map_min = force_min_stat_map_value if symmetric_cbar == 'auto' : symmetric_cbar = stat_map_min < 0 and stat_map_max > 0 if vmax is None : vmax = max ( - stat_map_min , stat_map_max ) vmin = - vmax if not symmetric_cbar : negative_range = stat_map_max <= 0 positive_range = stat_map_min >= 0 if positive_range : cbar_vmin = 0 cbar_vmax = None elif negative_range : cbar_vmax = 0 cbar_vmin = None else : cbar_vmin = stat_map_min cbar_vmax = stat_map_max else : cbar_vmin , cbar_vmax = None , None return cbar_vmin , cbar_vmax , vmin , vmax
short_docstring: Internal function for setting colormap and colorbar limits.
short_docstring_tokens: Internal function for setting colormap and colorbar limits .
comment: """Internal function for setting colormap and colorbar limits.
  
      Used by for plot_stat_map and plot_glass_brain.
  
      The limits for the colormap will always be set to range from -vmax to vmax.
      The limits for the colorbar depend on the symmetric_cbar argument, please
      refer to docstring of plot_stat_map.
  
      """$SEP$# make sure that the color range is symmetrical$SEP$# Avoid dealing with masked_array: