Plot non-contiguous slice of data

    Args
    ----
    data: ndarray
        The data with non continguous regions to plot
    ind: ndarray
        indices of data to be plotted
    color: matplotlib color
        Color of plotted line
    label: str
        Name to be shown in legend
    offset: int
        The number of index positions to reset start of data to zero
    linewidth: float
        The width of the plotted line
    linstyle: str
        The char representation of the plotting style for the line

    Returns
    -------
    ax: pyplot.ax
        Axes object with line glyph added for non-contiguous regions

def plot_noncontiguous(ax, data, ind, color='black', label='', offset=0,
        linewidth=0.5, linestyle='-'):
    '''Plot non-contiguous slice of data

    Args
    ----
    data: ndarray
        The data with non continguous regions to plot
    ind: ndarray
        indices of data to be plotted
    color: matplotlib color
        Color of plotted line
    label: str
        Name to be shown in legend
    offset: int
        The number of index positions to reset start of data to zero
    linewidth: float
        The width of the plotted line
    linstyle: str
        The char representation of the plotting style for the line

    Returns
    -------
    ax: pyplot.ax
        Axes object with line glyph added for non-contiguous regions
    '''

    def slice_with_nans(ind, data, offset):
        '''Insert nans in indices and data where indices non-contiguous'''
        import copy
        import numpy

        ind_nan          = numpy.zeros(len(data))
        ind_nan[:]       = numpy.nan

        # prevent ind from overwrite with deepcopy
        ind_nan[ind-offset] = copy.deepcopy(ind)
        #ind_nan             = ind_nan[ind[0]-offset:ind[-1]-offset]

        # prevent data from overwrite with deepcopy
        data_nan = copy.deepcopy(data)
        data_nan[numpy.isnan(ind_nan)] = numpy.nan

        return ind_nan, data_nan

    x, y = slice_with_nans(ind, data, offset)
    ax.plot(x, y, color=color, linewidth=linewidth, linestyle=linestyle,
            label=label)

    return ax