Calculate breaks given binwidth

    Parameters
    ----------
    x_range : array_like
        Range over with to calculate the breaks. Must be
        of size 2.
    bins : int
        Number of bins
    center : float
        The center of one of the bins
    boundary : float
        A boundary between two bins

    Returns
    -------
    out : array_like
        Sequence of break points.

def breaks_from_bins(x_range, bins=30, center=None, boundary=None):
    """
    Calculate breaks given binwidth

    Parameters
    ----------
    x_range : array_like
        Range over with to calculate the breaks. Must be
        of size 2.
    bins : int
        Number of bins
    center : float
        The center of one of the bins
    boundary : float
        A boundary between two bins

    Returns
    -------
    out : array_like
        Sequence of break points.
    """
    if bins < 1:
        raise PlotnineError("Need at least one bin.")
    elif bins == 1:
        binwidth = x_range[1] - x_range[0]
        boundary = x_range[1]
    else:
        binwidth = (x_range[1]-x_range[0])/(bins-1)

    return breaks_from_binwidth(x_range, binwidth, center, boundary)