sidpy/viz/plot_utils/misc.py
def make_scalar_mappable(vmin, vmax, cmap=None):
    """
    Creates a scalar mappable object that can be used to create a colorbar for non-image (e.g. - line) plots

    Parameters
    ----------
    vmin : Number
        Minimum value for colorbar
    vmax : Number
        Maximum value for colorbar
    cmap : colormap object
        Colormap object to use

    Returns
    -------
    sm : matplotlib.pyplot.cm.ScalarMappable object
        The object that can used to create a colorbar via plt.colorbar(sm)

    Adapted from: https://stackoverflow.com/questions/8342549/matplotlib-add-colorbar-to-a-sequence-of-line-plots
    """
    assert isinstance(vmin, Number), 'vmin should be a number'
    assert isinstance(vmax, Number), 'vmax should be a number'
    assert vmin < vmax, 'vmin must be less than vmax'

    if cmap is None:
        cmap = default_cmap
    else:
        assert isinstance(cmap, (mpl.colors.Colormap, str, unicode))
    sm = plt.cm.ScalarMappable(cmap=cmap,
                               norm=plt.Normalize(vmin=vmin, vmax=vmax))
    # fake up the array of the scalar mappable
    sm._A = []
    return sm

    Creates a scalar mappable object that can be used to create a colorbar for non-image (e.g. - line) plots

    Parameters
    ----------
    vmin : Number
        Minimum value for colorbar
    vmax : Number
        Maximum value for colorbar
    cmap : colormap object
        Colormap object to use

    Returns
    -------
    sm : matplotlib.pyplot.cm.ScalarMappable object
        The object that can used to create a colorbar via plt.colorbar(sm)

    Adapted from: https://stackoverflow.com/questions/8342549/matplotlib-add-colorbar-to-a-sequence-of-line-plots
    
Creates a scalar mappable object that can be used to create a colorbar for non-image  plots
Parameters

vmin : Number
Minimum value for colorbar
vmax : Number
Maximum value for colorbar
cmap : colormap object
Colormap object to use

Returns

sm : matplotlib.pyplot.cm.ScalarMappable object
The object that can used to create a colorbar via plt.colorbar(sm)


Creates a scalar mappable object that can be used to create a colorbar for non - image plots Parameters vmin : Number Minimum value for colorbar vmax : Number Maximum value for colorbar cmap : colormap object Colormap object to use Returns sm : matplotlib . pyplot . cm . ScalarMappable object The object that can used to create a colorbar via plt . colorbar ( sm )
def make_scalar_mappable(vmin, vmax, cmap=None):
    assert isinstance(vmin, Number), 'vmin should be a number'
    assert isinstance(vmax, Number), 'vmax should be a number'
    assert vmin < vmax, 'vmin must be less than vmax'
    if cmap is None:
        cmap = default_cmap
    else:
        assert isinstance(cmap, (mpl.colors.Colormap, str, unicode))
    sm = plt.cm.ScalarMappable(cmap=cmap,
                               norm=plt.Normalize(vmin=vmin, vmax=vmax))
    sm._A = []
    return sm
def make_scalar_mappable ( vmin , vmax , cmap = None ) : assert isinstance ( vmin , Number ) , 'vmin should be a number' assert isinstance ( vmax , Number ) , 'vmax should be a number' assert vmin < vmax , 'vmin must be less than vmax' if cmap is None : cmap = default_cmap else : assert isinstance ( cmap , ( mpl . colors . Colormap , str , unicode ) ) sm = plt . cm . ScalarMappable ( cmap = cmap , norm = plt . Normalize ( vmin = vmin , vmax = vmax ) ) sm . _A = [ ] return sm
Creates a scalar mappable object that can be used to create a colorbar for non-image (e.g.
Creates a scalar mappable object that can be used to create a colorbar for non - image ( e . g .
"""
    Creates a scalar mappable object that can be used to create a colorbar for non-image (e.g. - line) plots

    Parameters
    ----------
    vmin : Number
        Minimum value for colorbar
    vmax : Number
        Maximum value for colorbar
    cmap : colormap object
        Colormap object to use

    Returns
    -------
    sm : matplotlib.pyplot.cm.ScalarMappable object
        The object that can used to create a colorbar via plt.colorbar(sm)

    Adapted from: https://stackoverflow.com/questions/8342549/matplotlib-add-colorbar-to-a-sequence-of-line-plots
    """ # fake up the array of the scalar mappable
vmin
vmax
cmap