def setup(use_latex=False, overwrite=False):
    """Set up matplotlib imports and settings.

    Parameters
    ----------
    use_latex: bool, optional
        Determine if Latex output should be used. Latex will only be enable if
        a 'latex' binary is found in the system.
    overwrite: bool, optional
        Overwrite some matplotlib config values.

    Returns
    -------
    plt: :mod:`pylab`
        pylab module imported as plt
    mpl: :mod:`matplotlib`
        matplotlib module imported as mpl
    """
    # just make sure we can access matplotlib as mpl
    import matplotlib as mpl

    # general settings
    if overwrite:
        mpl.rcParams["lines.linewidth"] = 2.0
        mpl.rcParams["lines.markeredgewidth"] = 3.0
        mpl.rcParams["lines.markersize"] = 3.0
        mpl.rcParams["font.size"] = 12
        mpl.rcParams['mathtext.default'] = 'regular'
    if latex and use_latex:
        mpl.rcParams['text.usetex'] = True

        mpl.rc(
            'text.latex',
            preamble=''.join((
                #         r'\usepackage{droidsans}
                r'\usepackage[T1]{fontenc} ',
                r'\usepackage{sfmath} \renewcommand{\rmfamily}{\sffamily}',
                r'\renewcommand\familydefault{\sfdefault} ',
                r'\usepackage{mathastext} '
            ))
        )
    else:
        mpl.rcParams['text.usetex'] = False

    import matplotlib.pyplot as plt
    return plt, mpl
Set up matplotlib imports and settings.

    Parameters
    ----------
    use_latex: bool, optional
        Determine if Latex output should be used. Latex will only be enable if
        a 'latex' binary is found in the system.
    overwrite: bool, optional
        Overwrite some matplotlib config values.

    Returns
    -------
    plt: :mod:`pylab`
        pylab module imported as plt
    mpl: :mod:`matplotlib`
        matplotlib module imported as mpl