def tick_percent(decimals=1):
    """A tick formatter to display the y-axis as a float percentage with a given number of decimals.

    Args:
        decimals = 1: The number of decimals to display.

    Returns:
        A tick formatter function (f(y, position)) displaying y as a percentage.

    """
    return (lambda y, position: '{:.{decimals}f}%'.format(100.0 * y, decimals=decimals))