# Path: bioframe/core/arrops.py
# def natsort_key(s, _NS_REGEX=re.compile(r"(\d+)", re.U)):
# def natsorted(iterable):
# def argnatsort(array):
# def _find_block_span(arr, val):
# def interweave(a, b):
# def sum_slices(arr, starts, ends):
# def arange_multi(starts, stops=None, lengths=None):
# def _check_overlap(starts1, ends1, starts2, ends2, closed=False):
# def _size_overlap(starts1, ends1, starts2, ends2):
# def _overlap_intervals_legacy(starts1, ends1, starts2, ends2, closed=False, sort=False):
# def overlap_intervals(starts1, ends1, starts2, ends2, closed=False, sort=False):
# def overlap_intervals_outer(starts1, ends1, starts2, ends2, closed=False):
# def merge_intervals(starts, ends, min_dist=0):
# def complement_intervals(
#     starts,
#     ends,
#     bounds=(0, np.iinfo(np.int64).max),
# ):
# def _closest_intervals_nooverlap(
#     starts1, ends1, starts2, ends2, tie_arr=None, k_upstream=1, k_downstream=1
# ):
# def closest_intervals(
#     starts1,
#     ends1,
#     starts2=None,
#     ends2=None,
#     k=1,
#     tie_arr=None,
#     ignore_overlaps=False,
#     ignore_upstream=False,
#     ignore_downstream=False,
# ):
# def coverage_intervals_rle(starts, ends, weights=None):
# def stack_intervals(starts, ends):


import itertools
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from .core import arrops
    starts, ends : np.ndarray
        A collection of intervals.

    levels : iterable or None
        The level of each interval, i.e. the y-coordinate at which the interval
        must be plotted. If None, it will be determined automatically.

    labels : str or iterable or None
        The label of each interval.

    colors : str or iterable or None.
        The color of each interval.

    xlim : (float, float) or None
        The x-span of the plot.

    show_coords : bool
        If True, plot x-ticks.

    figsize : (float, float) or None.
        The size of the figure. If None, plot within the current figure.

    """
    starts = np.asarray(starts)
    ends = np.asarray(ends)

    if figsize is not None:
        plt.figure(figsize=figsize)

    if levels is None:

# Path: bioframe/core/arrops.py
# def natsort_key(s, _NS_REGEX=re.compile(r"(\d+)", re.U)):
# def natsorted(iterable):
# def argnatsort(array):
# def _find_block_span(arr, val):
# def interweave(a, b):
# def sum_slices(arr, starts, ends):
# def arange_multi(starts, stops=None, lengths=None):
# def _check_overlap(starts1, ends1, starts2, ends2, closed=False):
# def _size_overlap(starts1, ends1, starts2, ends2):
# def _overlap_intervals_legacy(starts1, ends1, starts2, ends2, closed=False, sort=False):
# def overlap_intervals(starts1, ends1, starts2, ends2, closed=False, sort=False):
# def overlap_intervals_outer(starts1, ends1, starts2, ends2, closed=False):
# def merge_intervals(starts, ends, min_dist=0):
# def complement_intervals(
#     starts,
#     ends,
#     bounds=(0, np.iinfo(np.int64).max),
# ):
# def _closest_intervals_nooverlap(
#     starts1, ends1, starts2, ends2, tie_arr=None, k_upstream=1, k_downstream=1
# ):
# def closest_intervals(
#     starts1,
#     ends1,
#     starts2=None,
#     ends2=None,
#     k=1,
#     tie_arr=None,
#     ignore_overlaps=False,
#     ignore_upstream=False,
#     ignore_downstream=False,
# ):
# def coverage_intervals_rle(starts, ends, weights=None):
# def stack_intervals(starts, ends):


# Path: bioframe/vis.py
import itertools
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from .core import arrops

    starts, ends : np.ndarray
        A collection of intervals.

    levels : iterable or None
        The level of each interval, i.e. the y-coordinate at which the interval
        must be plotted. If None, it will be determined automatically.

    labels : str or iterable or None
        The label of each interval.

    colors : str or iterable or None.
        The color of each interval.

    xlim : (float, float) or None
        The x-span of the plot.

    show_coords : bool
        If True, plot x-ticks.

    figsize : (float, float) or None.
        The size of the figure. If None, plot within the current figure.

    """
    starts = np.asarray(starts)
    ends = np.asarray(ends)

    if figsize is not None:
        plt.figure(figsize=figsize)

    if levels is None:

        levels = arrops.stack_intervals(starts, ends)