sidpy/viz/plot_utils/curve.py
def cbar_for_line_plot(axis, num_steps, discrete_ticks=True, **kwargs):
    """
    Adds a colorbar next to a line plot axis

    Parameters
    ----------
    axis : matplotlib.axes.Axes
        Axis with multiple line objects
    num_steps : uint
        Number of steps in the colorbar
    discrete_ticks : (optional) bool
        Whether or not to have the ticks match the number of number of steps. Default = True
    """
    if not isinstance(axis, mpl.axes.Axes):
        raise TypeError('axis must be a matplotlib.axes.Axes object')
    if not isinstance(num_steps, int) and num_steps > 0:
        raise TypeError('num_steps must be a whole number')
    assert isinstance(discrete_ticks, bool)

    cmap = get_cmap_object(kwargs.pop('cmap', None))
    cmap = discrete_cmap(num_steps, cmap=cmap.name)

    sm = make_scalar_mappable(0, num_steps, cmap=cmap)

    if discrete_ticks:
        kwargs.update({'ticks': np.arange(num_steps)})

    cbar = plt.colorbar(sm, ax=axis, orientation='vertical',
                        pad=0.04, use_gridspec=True, **kwargs)
    return cbar

    Adds a colorbar next to a line plot axis

    Parameters
    ----------
    axis : matplotlib.axes.Axes
        Axis with multiple line objects
    num_steps : uint
        Number of steps in the colorbar
    discrete_ticks : (optional) bool
        Whether or not to have the ticks match the number of number of steps. Default = True
    
Adds a colorbar next to a line plot axis
Parameters

axis : matplotlib.axes.Axes
Axis with multiple line objects
num_steps : uint
Number of steps in the colorbar
discrete_ticks : (optional) bool
Whether or not to have the ticks match the number of number of steps. Default = True
Adds a colorbar next to a line plot axis Parameters axis : matplotlib . axes . Axes Axis with multiple line objects num_steps : uint Number of steps in the colorbar discrete_ticks : ( optional ) bool Whether or not to have the ticks match the number of number of steps . Default = True
def cbar_for_line_plot(axis, num_steps, discrete_ticks=True, **kwargs):
    if not isinstance(axis, mpl.axes.Axes):
        raise TypeError('axis must be a matplotlib.axes.Axes object')
    if not isinstance(num_steps, int) and num_steps > 0:
        raise TypeError('num_steps must be a whole number')
    assert isinstance(discrete_ticks, bool)
    cmap = get_cmap_object(kwargs.pop('cmap', None))
    cmap = discrete_cmap(num_steps, cmap=cmap.name)
    sm = make_scalar_mappable(0, num_steps, cmap=cmap)
    if discrete_ticks:
        kwargs.update({'ticks': np.arange(num_steps)})
    cbar = plt.colorbar(sm, ax=axis, orientation='vertical',
                        pad=0.04, use_gridspec=True, **kwargs)
    return cbar
def cbar_for_line_plot ( axis , num_steps , discrete_ticks = True , ** kwargs ) : if not isinstance ( axis , mpl . axes . Axes ) : raise TypeError ( 'axis must be a matplotlib.axes.Axes object' ) if not isinstance ( num_steps , int ) and num_steps > 0 : raise TypeError ( 'num_steps must be a whole number' ) assert isinstance ( discrete_ticks , bool ) cmap = get_cmap_object ( kwargs . pop ( 'cmap' , None ) ) cmap = discrete_cmap ( num_steps , cmap = cmap . name ) sm = make_scalar_mappable ( 0 , num_steps , cmap = cmap ) if discrete_ticks : kwargs . update ( { 'ticks' : np . arange ( num_steps ) } ) cbar = plt . colorbar ( sm , ax = axis , orientation = 'vertical' , pad = 0.04 , use_gridspec = True , ** kwargs ) return cbar
Adds a colorbar next to a line plot axis
Parameters
Adds a colorbar next to a line plot axis Parameters
"""
    Adds a colorbar next to a line plot axis

    Parameters
    ----------
    axis : matplotlib.axes.Axes
        Axis with multiple line objects
    num_steps : uint
        Number of steps in the colorbar
    discrete_ticks : (optional) bool
        Whether or not to have the ticks match the number of number of steps. Default = True
    """
axis
num_steps
discrete_ticks