sidpy/viz/plot_utils/cmap.py
def make_linear_alpha_cmap(name, solid_color, normalization_val, min_alpha=0, max_alpha=1):
    """
    Generates a transparent to opaque color map based on a single solid color

    Parameters
    ----------
    name : String / Unicode
        Name of the desired colormap
    solid_color : List of numbers
        red, green, blue, and alpha values for a specific color
    normalization_val : number
        The common maximum value for the red, green, blue, and alpha values. This is 1 in matplotlib
    min_alpha : float (optional. Default = 0 : ie- transparent)
        Lowest alpha value for the bottom of the color bar
    max_alpha : float (optional. Default = 1 : ie- opaque)
        Highest alpha value for the top of the color bar

    Returns
    -------
    new_cmap : matplotlib.colors.LinearSegmentedColormap object
        transparent to opaque color map based on the provided color
    """
    if not isinstance(name, (str, unicode)):
        raise TypeError('name should be a string')
    if not isinstance(solid_color, (list, tuple, np.ndarray, da.core.Array)):
        raise TypeError('solid_color must be a list of numbers')
    if not len(solid_color) == 4:
        raise ValueError('solid-color should have fourth values')
    if not np.all([isinstance(x, Number) for x in solid_color]):
        raise TypeError('solid_color should have three numbers for red, green, blue')
    if not isinstance(normalization_val, Number):
        raise TypeError('normalization_val must be a number')
    if not isinstance(min_alpha, Number):
        raise TypeError('min_alpha should be a Number')
    if not isinstance(max_alpha, Number):
        raise TypeError('max_alpha should be a Number')
    if min_alpha >= max_alpha:
        raise ValueError('min_alpha must be less than max_alpha')

    solid_color = np.array(solid_color) / normalization_val * 1.0
    interp_table = [(1.0, (solid_color[0], solid_color[1], solid_color[2], max_alpha)),
                    (0, (solid_color[0], solid_color[1], solid_color[2], min_alpha))]
    return cmap_from_rgba(name, interp_table, 1)

    Generates a transparent to opaque color map based on a single solid color

    Parameters
    ----------
    name : String / Unicode
        Name of the desired colormap
    solid_color : List of numbers
        red, green, blue, and alpha values for a specific color
    normalization_val : number
        The common maximum value for the red, green, blue, and alpha values. This is 1 in matplotlib
    min_alpha : float (optional. Default = 0 : ie- transparent)
        Lowest alpha value for the bottom of the color bar
    max_alpha : float (optional. Default = 1 : ie- opaque)
        Highest alpha value for the top of the color bar

    Returns
    -------
    new_cmap : matplotlib.colors.LinearSegmentedColormap object
        transparent to opaque color map based on the provided color
    
Generates a transparent to opaque color map based on a single solid color
Parameters

name : String / Unicode
Name of the desired colormap
solid_color : List of numbers
red, green, blue, and alpha values for a specific color
normalization_val : number
The common maximum value for the red, green, blue, and alpha values. This is 1 in matplotlib
min_alpha : float (optional. Default = 0 : ie- transparent)
Lowest alpha value for the bottom of the color bar
max_alpha : float (optional. Default = 1 : ie- opaque)
Highest alpha value for the top of the color bar

Returns

new_cmap : matplotlib.colors.LinearSegmentedColormap object
transparent to opaque color map based on the provided color
Generates a transparent to opaque color map based on a single solid color Parameters name : String / Unicode Name of the desired colormap solid_color : List of numbers red green blue and alpha values for a specific color normalization_val : number The common maximum value for the red green blue and alpha values . This is 1 in matplotlib min_alpha : float ( optional . Default = 0 : ie - transparent ) Lowest alpha value for the bottom of the color bar max_alpha : float ( optional . Default = 1 : ie - opaque ) Highest alpha value for the top of the color bar Returns new_cmap : matplotlib . colors . LinearSegmentedColormap object transparent to opaque color map based on the provided color
def make_linear_alpha_cmap(name, solid_color, normalization_val, min_alpha=0, max_alpha=1):
    if not isinstance(name, (str, unicode)):
        raise TypeError('name should be a string')
    if not isinstance(solid_color, (list, tuple, np.ndarray, da.core.Array)):
        raise TypeError('solid_color must be a list of numbers')
    if not len(solid_color) == 4:
        raise ValueError('solid-color should have fourth values')
    if not np.all([isinstance(x, Number) for x in solid_color]):
        raise TypeError('solid_color should have three numbers for red, green, blue')
    if not isinstance(normalization_val, Number):
        raise TypeError('normalization_val must be a number')
    if not isinstance(min_alpha, Number):
        raise TypeError('min_alpha should be a Number')
    if not isinstance(max_alpha, Number):
        raise TypeError('max_alpha should be a Number')
    if min_alpha >= max_alpha:
        raise ValueError('min_alpha must be less than max_alpha')
    solid_color = np.array(solid_color) / normalization_val * 1.0
    interp_table = [(1.0, (solid_color[0], solid_color[1], solid_color[2], max_alpha)),
                    (0, (solid_color[0], solid_color[1], solid_color[2], min_alpha))]
    return cmap_from_rgba(name, interp_table, 1)
def make_linear_alpha_cmap ( name , solid_color , normalization_val , min_alpha = 0 , max_alpha = 1 ) : if not isinstance ( name , ( str , unicode ) ) : raise TypeError ( 'name should be a string' ) if not isinstance ( solid_color , ( list , tuple , np . ndarray , da . core . Array ) ) : raise TypeError ( 'solid_color must be a list of numbers' ) if not len ( solid_color ) == 4 : raise ValueError ( 'solid-color should have fourth values' ) if not np . all ( [ isinstance ( x , Number ) for x in solid_color ] ) : raise TypeError ( 'solid_color should have three numbers for red, green, blue' ) if not isinstance ( normalization_val , Number ) : raise TypeError ( 'normalization_val must be a number' ) if not isinstance ( min_alpha , Number ) : raise TypeError ( 'min_alpha should be a Number' ) if not isinstance ( max_alpha , Number ) : raise TypeError ( 'max_alpha should be a Number' ) if min_alpha >= max_alpha : raise ValueError ( 'min_alpha must be less than max_alpha' ) solid_color = np . array ( solid_color ) / normalization_val * 1.0 interp_table = [ ( 1.0 , ( solid_color [ 0 ] , solid_color [ 1 ] , solid_color [ 2 ] , max_alpha ) ) , ( 0 , ( solid_color [ 0 ] , solid_color [ 1 ] , solid_color [ 2 ] , min_alpha ) ) ] return cmap_from_rgba ( name , interp_table , 1 )
Generates a transparent to opaque color map based on a single solid color
Parameters
Generates a transparent to opaque color map based on a single solid color Parameters
"""
    Generates a transparent to opaque color map based on a single solid color

    Parameters
    ----------
    name : String / Unicode
        Name of the desired colormap
    solid_color : List of numbers
        red, green, blue, and alpha values for a specific color
    normalization_val : number
        The common maximum value for the red, green, blue, and alpha values. This is 1 in matplotlib
    min_alpha : float (optional. Default = 0 : ie- transparent)
        Lowest alpha value for the bottom of the color bar
    max_alpha : float (optional. Default = 1 : ie- opaque)
        Highest alpha value for the top of the color bar

    Returns
    -------
    new_cmap : matplotlib.colors.LinearSegmentedColormap object
        transparent to opaque color map based on the provided color
    """
name
solid_color
normalization_val
min_alpha
max_alpha