B
    â‹då  ã               @   s"   d Z dd„ Zddd„Zdd„ ZdS )	z4 Plotting utilities and premade plot configurations
c             K   sˆ   ddl }t| | |k ƒ}|j| | |k  f|Ž d|kr@|d }nd}|dkr„|j|d |d|dd }| | ¡ d| ¡  d| ¡ dS )	z5 Make a histogram with an overflow bar above val_max é    NÚcolorgš™™™™™©?g      à?)r   gš™™™™™ñ?z%s+)ÚpylabÚlenÚhistÚbarÚtextZget_xZ
get_height)ÚvalZval_maxÚkwdsr   Úoverflowr   Úrect© r   ú_/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/pycbc/results/plot.pyÚhist_overflow   s    

r   Nc             C   s2   ddl m} | jd|dg|jj dg dd dS )	a6  Adds an option to set the matplotlib style to a parser.

    Parameters
    ----------
    parser : argparse.ArgumentParser
        The parser to add the option to.
    default : str, optional
        The default style to use. Default, None, will result in the default
        matplotlib style to be used.
    r   )Úpyplotz--mpl-styleÚdefaultÚxkcdz Set the matplotlib style to use.)r   ÚchoicesÚhelpN)Ú
matplotlibr   Úadd_argumentÚstyleÚ	available)Úparserr   r   r   r   r   Úadd_style_opt_to_parser   s    r   c             C   s<   ddl m} | jdkr | ¡  n| jdk	r8|j | j¡ dS )zkUses the mpl-style option to set the style for plots.

    Note: This will change the global rcParams.
    r   )r   r   N)r   r   Z	mpl_styler   r   Zuse)Úoptsr   r   r   r   Úset_style_from_cli'   s
    


r   )N)Ú__doc__r   r   r   r   r   r   r   Ú<module>   s   
