def _get_cmap_norms():
 cmap = get_cmap(u'RdBu', lut=5)
 clevs = [(-5.0), (-2.5), (-0.5), 0.5, 1.5, 3.5]
 norms = dict()
 norms[u'neither'] = BoundaryNorm(clevs, (len(clevs) - 1))
 norms[u'min'] = BoundaryNorm(([(-10)] + clevs[1:]), (len(clevs) - 1))
 norms[u'max'] = BoundaryNorm((clevs[:(-1)] + [10]), (len(clevs) - 1))
 norms[u'both'] = BoundaryNorm((([(-10)] + clevs[1:(-1)]) + [10]), (len(clevs) - 1))
 return (cmap, norms)

def _get_cmap_norms ( ) : cmap = get_cmap ( u'RdBu' , lut = 5 ) clevs = [ ( - 5.0 ) , ( - 2.5 ) , ( - 0.5 ) , 0.5 , 1.5 , 3.5 ] norms = dict ( ) norms [ u'neither' ] = BoundaryNorm ( clevs , ( len ( clevs ) - 1 ) ) norms [ u'min' ] = BoundaryNorm ( ( [ ( - 10 ) ] + clevs [ 1 : ] ) , ( len ( clevs ) - 1 ) ) norms [ u'max' ] = BoundaryNorm ( ( clevs [ : ( - 1 ) ] + [ 10 ] ) , ( len ( clevs ) - 1 ) ) norms [ u'both' ] = BoundaryNorm ( ( ( [ ( - 10 ) ] + clevs [ 1 : ( - 1 ) ] ) + [ 10 ] ) , ( len ( clevs ) - 1 ) ) return ( cmap , norms )
define a colormap and appropriate norms for each of the four possible settings of the extend keyword .