def _patch_center(patch, orient='v'):
    """
    Get coordinate of bar center

    Parameters
    ----------
    patch : matplotlib patch
    orient : 'v' | 'h'

    Returns
    -------
    center : float
    """

    if orient not in 'v h'.split():
        raise Exception("Orientation must be 'v' or 'h'")

    if orient == 'v':
        x = patch.get_x()
        width = patch.get_width()
        xpos = x + width / 2
        return xpos
    else:
        y = patch.get_y()
        height = patch.get_height()
        ypos = y + height / 2
        return ypos