Step plot of DataArray index against values

    Similar to :func:`matplotlib:matplotlib.pyplot.step`

    Parameters
    ----------
    where : {'pre', 'post', 'mid'}, optional, default 'pre'
        Define where the steps should be placed:
        - 'pre': The y value is continued constantly to the left from
          every *x* position, i.e. the interval ``(x[i-1], x[i]]`` has the
          value ``y[i]``.
        - 'post': The y value is continued constantly to the right from
          every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the
          value ``y[i]``.
        - 'mid': Steps occur half-way between the *x* positions.
        Note that this parameter is ignored if the x coordinate consists of
        :py:func:`pandas.Interval` values, e.g. as a result of
        :py:func:`xarray.Dataset.groupby_bins`. In this case, the actual
        boundaries of the interval are used.

    *args, **kwargs : optional
        Additional arguments following :py:func:`xarray.plot.line`

def step(darray, *args, **kwargs):
    """
    Step plot of DataArray index against values

    Similar to :func:`matplotlib:matplotlib.pyplot.step`

    Parameters
    ----------
    where : {'pre', 'post', 'mid'}, optional, default 'pre'
        Define where the steps should be placed:
        - 'pre': The y value is continued constantly to the left from
          every *x* position, i.e. the interval ``(x[i-1], x[i]]`` has the
          value ``y[i]``.
        - 'post': The y value is continued constantly to the right from
          every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the
          value ``y[i]``.
        - 'mid': Steps occur half-way between the *x* positions.
        Note that this parameter is ignored if the x coordinate consists of
        :py:func:`pandas.Interval` values, e.g. as a result of
        :py:func:`xarray.Dataset.groupby_bins`. In this case, the actual
        boundaries of the interval are used.

    *args, **kwargs : optional
        Additional arguments following :py:func:`xarray.plot.line`

    """
    if ('ls' in kwargs.keys()) and ('linestyle' not in kwargs.keys()):
        kwargs['linestyle'] = kwargs.pop('ls')

    where = kwargs.pop('where', 'pre')

    if where not in ('pre', 'post', 'mid'):
        raise ValueError("'where' argument to step must be "
                         "'pre', 'post' or 'mid'")

    kwargs['linestyle'] = 'steps-' + where + kwargs.get('linestyle', '')

    return line(darray, *args, **kwargs)