def _plot_ulims(ax, x, y, xerr, color, capsize=5, height_fraction=0.25,
    elinewidth=2):
    """
    Plot upper limits as arrows with cap at value of upper limit.

    uplim behaviour has been fixed in matplotlib 1.4
    """
    ax.errorbar(x, y, xerr=xerr, ls='', color=color, elinewidth=elinewidth,
        capsize=0)
    from distutils.version import LooseVersion
    import matplotlib
    mpl_version = LooseVersion(matplotlib.__version__)
    if mpl_version >= LooseVersion('1.4.0'):
        ax.errorbar(x, y, yerr=height_fraction * y, ls='', uplims=True,
            color=color, elinewidth=elinewidth, capsize=capsize, zorder=10)
    else:
        ax.errorbar(x, (1 - height_fraction) * y, yerr=height_fraction * y,
            ls='', lolims=True, color=color, elinewidth=elinewidth, capsize
            =capsize, zorder=10)
