Set matplotlib.rcParams['font.size'] value so that
    all texts on a plot would look nice in terms of fontsize.

    [NOTE] The formula for the font size is:

    fontsize = sqrt(fig_area) * 'scale'

    where fig_area = fig_height * fig_width (in inch)

def set_global_fontsize_from_fig(fig, scale=1.5):
    """
    Set matplotlib.rcParams['font.size'] value so that
    all texts on a plot would look nice in terms of fontsize.

    [NOTE] The formula for the font size is:

    fontsize = sqrt(fig_area) * 'scale'

    where fig_area = fig_height * fig_width (in inch)
    """

    fig_size_inch = fig.get_size_inches()
    fig_size_len_geom_mean = (fig_size_inch[0] * fig_size_inch[1]) ** 0.5
    rcParams['font.size'] = fig_size_len_geom_mean * scale
    return rcParams['font.size']