def get_leg_args(cfg):
    """Get legend args from config file.

    Args:
        cfg (dict): config settings.

    Returns:
        dict: Keyword args to pass to legend.
    """
    leg_args = dict(scatterpoints=1, handletextpad=0.05, labelspacing=0.01,
                    borderpad=0.2, borderaxespad=0.5, loc=3)
    try:
        args = cfg['Legend']
        for k, v in args.items():
            try:
                v = float(v)
            except ValueError:
                continue
            leg_args[k] = v
    except KeyError:
        pass
    return leg_args