def fmt(x, pos):
    """
    Format color bar labels
    """

    if abs(x) > 1e4 or (abs(x) < 1e-2 and abs(x) > 0):
        a, b = f"{x:.2e}".split("e")
        b = int(b)
        return fr"${a} \cdot 10^{{{b}}}$"
    elif abs(x) > 1e2 or (float(abs(x))).is_integer():
        return fr"${int(x):d}$"
    elif abs(x) > 1e1:
        return fr"${x:.1f}$"
    elif abs(x) == 0.0:
        return fr"${x:.1f}$"
    else:
        return fr"${x:.2f}$"