Create a function that can replace the
    :func:`matplotlib.axes.Axes.format_coord`

    Parameters
    ----------
    ax: matplotlib.axes.Axes
        The axes instance
    ref: weakref.weakref
        The reference to the :class:`~psyplot.plotter.Formatoption` instance

    Returns
    -------
    function
        The function that can be used to replace `ax.format_coord`

def format_coord_func(ax, ref):
    """Create a function that can replace the
    :func:`matplotlib.axes.Axes.format_coord`

    Parameters
    ----------
    ax: matplotlib.axes.Axes
        The axes instance
    ref: weakref.weakref
        The reference to the :class:`~psyplot.plotter.Formatoption` instance

    Returns
    -------
    function
        The function that can be used to replace `ax.format_coord`
    """
    orig_format_coord = ax.format_coord

    def func(x, y):
        orig_s = orig_format_coord(x, y)
        fmto = ref()
        if fmto is None:
            return orig_s
        try:
            orig_s += fmto.add2format_coord(x, y)
        except Exception:
            fmto.logger.debug(
                'Failed to get plot informations for status bar!', exc_info=1)
        return orig_s

    return func