def get_label_offset()

in history/graph.py [0:0]


def get_label_offset(x, y, ax):
    # Get the current axis limits
    xlim = ax.get_xlim()
    ylim = ax.get_ylim()

    # Determine where to place the label based on the position in the graph
    if x < (xlim[0] + xlim[1]) / 2:
        x_offset = 1  # Right
    else:
        x_offset = -2  # Left

    if y < (ylim[0] + ylim[1]) / 2:
        y_offset = 0.1  # Above
    else:
        y_offset = -0.1  # Below

    return x_offset, y_offset