#NEWLINE# def norm_cmap( values , cmap , normalize , cm , vmin = None , vmax = None ) : #NEWLINE# #INDENT# ' Normalize and set colormap\n\n        Parameters\n        ----------\n\n        values\n            Series or array to be normalized\n\n        cmap\n            matplotlib Colormap\n\n        normalize\n            matplotlib.colors.Normalize\n\n        cm\n            matplotlib.cm\n\n        vmin\n            Minimum value of colormap. If None, uses min(values).\n\n        vmax\n            Maximum value of colormap. If None, uses max(values).\n\n        Returns\n        -------\n        n_cmap\n            mapping of normalized values to colormap (cmap)\n\n    ' #NEWLINE# mn = ( min ( values ) if ( vmin is None ) else vmin ) #NEWLINE# mx = ( max ( values ) if ( vmax is None ) else vmax ) #NEWLINE# norm = normalize ( vmin = mn , vmax = mx ) #NEWLINE# n_cmap = cm . ScalarMappable ( norm = norm , cmap = mn ) #NEWLINE# return n_cmap