def _colorbar_extension_length(spacing):
 (cmap, norms) = _get_cmap_norms()
 fig = plt.figure()
 fig.subplots_adjust(hspace=0.6)
 for (i, extension_type) in enumerate((u'neither', u'min', u'max', u'both')):
  norm = norms[extension_type]
  boundaries = values = norm.boundaries
  for (j, extendfrac) in enumerate((None, u'auto', 0.1)):
   cax = fig.add_subplot(12, 1, (((i * 3) + j) + 1))
   for item in (((cax.get_xticklabels() + cax.get_yticklabels()) + cax.get_xticklines()) + cax.get_yticklines()):
    item.set_visible(False)
   ColorbarBase(cax, cmap=cmap, norm=norm, boundaries=boundaries, values=values, extend=extension_type, extendfrac=extendfrac, orientation=u'horizontal', spacing=spacing)
 return fig

def _colorbar_extension_length ( spacing ) : ( cmap , norms ) = _get_cmap_norms ( ) fig = plt . figure ( ) fig . subplots_adjust ( hspace = 0.6 ) for ( i , extension_type ) in enumerate ( ( u'neither' , u'min' , u'max' , u'both' ) ) : norm = norms [ extension_type ] boundaries = values = norm . boundaries for ( j , extendfrac ) in enumerate ( ( None , u'auto' , 0.1 ) ) : cax = fig . add_subplot ( 12 , 1 , ( ( ( i * 3 ) + j ) + 1 ) ) for item in ( ( ( cax . get_xticklabels ( ) + cax . get_yticklabels ( ) ) + cax . get_xticklines ( ) ) + cax . get_yticklines ( ) ) : item . set_visible ( False ) ColorbarBase ( cax , cmap = cmap , norm = norm , boundaries = boundaries , values = values , extend = extension_type , extendfrac = extendfrac , orientation = u'horizontal' , spacing = spacing ) return fig
produce 12 colorbars with variable length extensions for either uniform or proportional spacing .