def estimate_text_size()

in functions/source/preprocess/preprocess.py [0:0]


def estimate_text_size(text):
    """
    Provide a text size estimate based on the length of the text
    Parameters
    ----------
    text: string
        Text meant to print on the IWP plot
    Returns
    -------
    fontsize: float
        Estimated best fontsize
    """
    fontsize = 12
    if len(text) > 50:
        fontsize -= (len(text) - 50) / 5
    if fontsize < 5:
        fontsize = 5
    return fontsize