B
    }d                 @   s  d Z ddlmZmZmZ ddlmZ ddlmZ e Z	ye
dg ej ZW n, ek
rx   e
ddd	ej ZY nX d
Zef ddddddddddgddddged  ddddddZef dedgdddZd.dd Zd!d"d#d$Zd%d&d'd(d)d*d+Zd,d- ZdS )/z$Custom default figure configuration
    )rcParams	rc_paramsRcParams   )tex   )bool_envztext.latex.preamble 
z(Duncan Macleod <duncan.macleod@ligo.org>grayTFg      ?)      Zlargez
sans-serifZFreeSanszHelvetica NeueZ	HelveticaZArialzfont.sans-serif   inherit)zaxes.edgecolorz	axes.gridzaxes.axisbelowzgrid.linewidthzaxes.formatter.limitszaxes.formatter.use_mathtextzaxes.labelpadzaxes.titlesizezaxes.labelsizezfont.familyzfont.sans-serifz	font.sizezlegend.edgecolorzlegend.numpointszlegend.handlelengthzlegend.fancyboxZserif   )ztext.usetexztext.latex.preamblezfont.familyz	font.sizezaxes.formatter.use_mathtextNc             C   s:   | dkr t dtd pt d} t }| r6|t |S )a  Returns a new `matplotlib.RcParams` with updated GWpy parameters

    The updated parameters are globally stored as
    `gwpy.plot.rc.GWPY_RCPARAMS`, with the updated TeX parameters as
    `gwpy.plot.rc.GWPY_TEX_RCPARAMS`.

    .. note::

       This function doesn't apply the new `RcParams` in any way, just
       creates something that can be used to set `matplotlib.rcParams`.

    Parameters
    ----------
    usetex : `bool`, `None`
        value to set for `text.usetex`; if `None` determine automatically
        using the ``GWPY_USETEX`` environment variable, and whether `tex`
        is available on the system. If `True` is given (or determined)
        a number of other parameters are updated to improve TeX formatting.

    Examples
    --------
    >>> import matplotlib
    >>> from gwpy.plot.rc import rc_params as gwpy_rc_params()
    >>> matplotlib.rcParams.update(gwpy_rc_params(usetex=False))
    NZGWPY_USETEXztext.usetex)default)r   r   r   Zhas_texGWPY_RCPARAMScopyupdateGWPY_TEX_RCPARAMS)ZusetexZrcp r   Y/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/gwpy/plot/rc.pyr   S   s    
r   )g      ?gףp=
?)g333333?g333333?)g?g?)g@g       @g      (@)g      ?g(\?)g?g333333?)g{Gz?g)\(?)g333333?g{Gz?)gp=
ף?g?)g?g(\?)g      @g      @g333333@r   g      @g       @c             C   s   ddl m} | \}}yt| \}}W n tk
r@   d }}Y nX yt| \}}W n tk
rn   d }}Y nX |||||dS )a6  Return sensible default `SubplotParams` for a figure of the given size

    Parameters
    ----------
    figsize : `tuple` of `float`
         the ``(width, height)`` figure size (inches)

    Returns
    -------
    params : `~matplotlib.figure.SubplotParams`
        formatted set of subplot parameters
    r   )SubplotParamsN)leftbottomrighttop)Zmatplotlib.figurer   SUBPLOT_WIDTHKeyErrorSUBPLOT_HEIGHT)Zfigsizer   widthheightr   r   r   r   r   r   r   get_subplot_params   s    r#   )N)__doc__Z
matplotlibr   r   r   r	   r   Z	utils.envr   ZMPL_RCPARAMSgetZMACROSZPREAMBLE	TypeErrorjoin
__author__r   r   r   r    r#   r   r   r   r   <module>   s^   


,