
W[c        '   @   s  d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l Z	 d  d l
 Z d  d l Z d  d l j Z d d l m Z d d l m Z d d	 l m Z m Z m Z m Z m Z d d
 l m Z d d l m Z m Z m Z d d l  m! Z! m" Z" d d d g Z# d e$ f d     YZ% d e% f d     YZ& d e% f d     YZ' e( d e d  d e d  d e d  d e d  d e d  d  e d!  d" e d#  d$ e d%  d& e d'  d( e d)  d* e d+  d, e d-  d. e d/  d0 e d1  d2 e d3  d4 e d5  d6 e d7  d8 e d9  d: d;  Z) e) j* e"  e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e, e+ e+ e+ d< d= d> e, d? e+ d@ e+ dA  Z- e dB  j. e)   e- _/ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e, e+ e+ e+ e+ e+ d= d> dC e+ e+ d@ e+ dD  Z0 e dE  j. e)   e0 _/ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ e+ d@ dF dG d e+ dH  Z1 e dI  j. e)   e1 _/ d S(J   i(   t   division(   t   product(   t   dedent(   t   LooseVersionNi   (   t   string_types(   t   utils(   t   categorical_ordert   get_color_cyclet   ci_to_errsizet   sort_dft	   remove_na(   t	   bootstrap(   t   color_palettet   cubehelix_palettet   _parse_cubehelix_args(   t	   FacetGridt   _facet_docst   relplott   scatterplott   lineplott   _RelationalPlotterc           B   s  e  Z e e j  d  k r< d d d d d d d d g Z n d d d d d d g Z d	 d d d  d! d" g Z d# d# d# d# d# d# d# d  Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS($   s   2.0t   ot   Xt   st   Pt   Dt   ^t   vt   pt    i   g      ?i   i   i   i   c         C   s  d } }	 }
 } } | d k r| d k rd |  _ t | t j  ry | j t j  Wn# t k
 r d } t |   n X| j	   } | j
 | j d d  d f <t j | d d d d d } | d | d	 <t | j
 d
 d  } t | j d
 d  }
 } q2t |  s/t j d d d g  } q2t j t j |  d  rt | d t j t |    } t j t d | d |   } q2t | d  rt j |  } | j
 | j d d  d f <t j | d d d d d } | d | d	 <q2g  } x t |  D]| \ } } t | d t j t |    } t | d
 |  } t d | d | d | d	 | d d  } | j t j |   q	Wt j |  } n| d k	 r | d k	 r d |  _ | d k	 r7| j | |  } | j | |  } | j | |  } | j | |  } | j | |  } | j | |  } n  xM | | | | | | g D]3 } t | t  rPd j |  } t |   qPqPWt | d
 d  } t | d
 d  }	 t | d
 d  }
 t | d
 d  } t | d
 d  } t d | d | d | d	 | d | d |  } t j |  } n d } t |   x3 d d	 d d g D] } | | k rEd | | <qEqEW| j   j   } d d g g  d d d	 g D] } | | r| ^ q} | |  _ |	 |  _ |
 |  _ | |  _  | |  _! | |  _" | |  _# | S(   s-   Parse the inputs to define data for plotting.t   wides0   A wide-form input must have only numeric values.Nt   xt   var_namet   huet
   value_namet   yt   stylet   namet   columnsi    t   indext   shapet   sizet   longs   Could not interpret input '{}'t   unitssl   Either both or neither of `x` and `y` must be specified (but try passing to `data`, which is more flexible).($   t   Nonet   input_formatt
   isinstancet   pdt	   DataFramet   astypet   npt   floatt
   ValueErrort   copyR'   t   loct   meltt   getattrR&   t   lent   isscalart   asarrayt   aranget   dictt   hasattrt	   enumeratet   appendt   concatt   getR   t   formatt   notnullt   anyt   x_labelt   y_labelt	   hue_labelt
   size_labelt   style_labelt	   plot_datat	   semantics(   t   selfR   R#   R!   R)   R$   R+   t   dataRF   RG   RH   RI   RJ   t   errRK   t   it   data_it   nt   vart   attrt
   plot_validR%   RL   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt   establish_variables"   s    	
	!!	!'										c   	      C   s1  | d k r t |  } n | } t |  } t | t  r t |  t |  } t |  r'd } t | j |    q'n | d k r | t t	    k r t
 d |  } qt
 d |  } nN t | t  rt |  | k r d } t |   n  | } n t
 | |  } t t | |   } | | f S(   s6   Determine colors when the hue variable is qualitative.s*   The palette dictionary is missing keys: {}t   husls0   The palette list has the wrong number of colors.N(   R,   R   R9   R.   R=   t   setRE   R4   RC   R   R   t   listt   zip(	   RM   RN   t   ordert   palettet   levelst   n_colorst   missingRO   t   colors(    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt   categorical_to_palette   s*    	c   
      C   s  t  t j t | j      } | d k r3 d n | } t | t j j	  rW | } n t
 |  j d  r t |  \ } } t d d t | | } nB y t j j |  } Wn) t t f k
 r d }	 t |	   n X| d k r t j j   } nN t | t  rt j j |   } n* t | t j j  sGd }	 t |	   n  | j   so| t j | j     n  t t | | | |     } | | | | f S(   s7   Determine colors when the hue variable is quantitative.s   ch:i    t   as_cmaps   Palette {} not understoods6   ``hue_norm`` must be None, tuple, or Normalize object.N(   RY   R2   t   sortR
   t   uniqueR,   R.   t   mplR`   t   Colormapt   strt
   startswithR   R   t   Truet   cmt   get_cmapR4   t	   TypeErrort	   Normalizet   tuplet   scaledR;   t   dropnaR=   RZ   (
   RM   RN   R[   R\   t   normR]   t   cmapt   argst   kwargsRO   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt   numeric_to_palette   s.    !	!c         C   sg   |  j  d k rI |  j |  } t j j |  r< t j } n  |  j |  S|  j  d k rc |  j | Sd S(   s0   Return the color corresponding to the hue level.t   numerict   categoricalN(   t   hue_typet   hue_normR2   t   mat	   is_maskedt   nanRr   R\   (   RM   t   keyt   normed(    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt   color_lookup  s    c         C   sq   |  j  d k rS |  j \ } } |  j |  } t j j |  rC d S| | | | S|  j  d k rm |  j | Sd S(   s0   Return the size corresponding to the size level.Rv   i    Rw   N(   t	   size_typet
   size_ranget	   size_normR2   Rz   R{   t   sizes(   RM   R}   t   min_sizet   max_sizet   val(    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt   size_lookup  s    c         C   s   | t  k r$ t t | |   } nB | rB t | t  rB | } n$ | r` t t | |   } n i  } | r t |  t |  } t |  r d } t | j | |    q n  | S(   s<   Convert a style argument to a dict of matplotlib attributes.s'   These `style` levels are missing {}: {}(   Ri   R=   RZ   R.   RX   RE   R4   RC   (   RM   R]   R$   t   defaultsR%   t   attrdictt   missing_levelsRO   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt   style_to_attributes"  s    	c         c   st  |  j  } t j t | j  } t |  j |  j |  j  } x4| D],\ } } } | d
 k ra | n | d | k } | d
 k r | n | d | k } | d
 k r | n | d | k }	 | | @|	 @}
 | j
 j d  | d <| j |
 d d d g f j   } t |  sq@ n  |  j r1t | d d d g  } n  |  j
 d
 k rX| j d d d	 } n  | | | f | f Vq@ Wd
 S(   s8   Return (x, y) data for each subset defined by semantics.R!   R)   R$   R   R+   R   R#   t   axisi   N(   RK   R/   t   SeriesRi   R'   R   t
   hue_levelst   size_levelst   style_levelsR,   R+   t   fillnaR6   Rp   R9   Rc   R	   t   drop(   RM   RN   t   all_truet   iter_levelsR!   R)   R$   t   hue_rowst	   size_rowst
   style_rowst   rowst   subset_data(    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR   5  s&    		""""	c   	      C   s  |  j  |  r9 d g } d } d } i  } d } d } n- |  j |  } t | t t f  rf d } n  | d k r d } d } |  j | | |  \ } } nE | d k r |  j | | | |  \ } } } } | j | j	 f } n  | |  _
 | |  _ | |  _ | |  _ | |  _ | |  _ d S(   s8   Determine what colors to use given data characteristics.Rw   Rv   N(   t   _empty_dataR,   t   _semantic_typeR.   R=   RY   Ra   Ru   t   vmint   vmaxR   Ry   t
   hue_limitsRx   R\   Rr   (	   RM   RN   R\   R[   Rq   R]   t   limitst   var_typeRr   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt	   parse_hueS  s2    								c         C   s|  |  j  |  r9 d g } d } d } i  } d } d } n	|  j |  } | d k r t | |  } t j d d t |   d d d  }	 n. | d k r t j t | j	     } }	 n  t
 | t t f  rt
 | t  r&t |  t |  k rd }
 t |
   n  t t | |   } n  t |  t |  } t |  rfd }
 t |
 j |    n  t | j    t | j    f } y( t | j    t | j    f } WqBt k
 rd } qBXns| d k r|  j \ } } nE y | \ } } Wn2 t t f k
 r1d j |  }
 t |
   n X| | f } | d k r\t j j   } nN t
 | t  rt j j |   } n* t
 | t j j  sd	 }
 t |
   n  t | _ | j   s| t j |	   n  | j  | j! f } | |	  } t j | | | |  } | j" j   r-d
 | | j" <n  t t | |   } | |  _# | |  _$ | |  _% | |  _& | |  _' | |  _( d S(   s4   Determine the linewidths given data characteristics.Rw   i   NiRv   s+   The `sizes` list has wrong number of levelss*   Missing sizes for the following levels: {}s    sizes argument {} not understoods7   ``size_norm`` must be None, tuple, or Normalize object.i    ()   R   R,   R   R   R2   R<   R9   Rc   R
   Rd   R.   R=   RY   R4   RZ   RX   RE   RC   t   mint   valuest   maxt   keysRl   t   _default_size_rangeRe   R`   Rm   Rn   Ri   t   clipRo   R;   R   R   t   maskR   R   R   R   t   size_limitsR   (   RM   RN   R   R[   Rq   R]   R   R   t   width_ranget   numbersRO   R_   t	   min_widtht	   max_widtht   sclt   widths(    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt
   parse_size  st    		,"$(						c         C   sY  |  j  |  r' d g } i  } i  } nW | d k rB t |  } n | } |  j | | |  j d  } |  j | | |  j d  } i  } g  } xv | j   D]h \ } }	 t |	 t j	 j
  s t j	 j
 |	  }	 n  |	 j   j |	 j    | | <| j |	 j    q Wt |  r1t |  r1d }
 t |
   n  | |  _ | |  _ | |  _	 | |  _ d S(   s&   Determine the markers and line dashes.t   markerst   dashess+   Filled and line art markers cannot be mixedN(   R   R,   R   R   t   default_markerst   default_dashest   itemsR.   Re   R   t   MarkerStylet   get_patht   transformedt   get_transformR@   t	   is_filledRE   t   allR4   R   R   t   paths(   RM   RN   R   R   R[   R]   R   t   filled_markerst   kt   mRO   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt   parse_style  s2    					c         C   s   | j    j   S(   s'   Test if a series is completely missing.(   t   isnullR   (   RM   RN   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR     s    c         C   s   |  j  d k r d SyT | j t j  } t j | j    } t j | t j d d g   rb d Sd SWn t t	 f k
 r d SXd S(   s;   Determine if data should considered numeric or categorical.R   Rw   g        g      ?Rv   N(
   R-   R1   R2   R3   Rd   Rp   t   array_equalt   arrayR4   Rl   (   RM   RN   t
   float_dataR   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR     s    !c         C   s   |  j  d k	 rD t d   | j   D  } | j |  j  d | n  |  j d k	 r t d   | j   D  } | j |  j d | n  d S(   s?   Set x and y labels with visibility that matches the ticklabels.c         s   s   |  ] } | j    Vq d  S(   N(   t   get_visible(   t   .0t   t(    (    s1   lib/python2.7/site-packages/seaborn/relational.pys	   <genexpr>  s    t   visiblec         s   s   |  ] } | j    Vq d  S(   N(   R   (   R   R   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pys	   <genexpr>  s    N(   RF   R,   RE   t   get_xticklabelst
   set_xlabelRG   t   get_yticklabelst
   set_ylabel(   RM   t   axt	   x_visiblet	   y_visible(    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt
   label_axes  s    c            s  |  j  } | d k r* d } t |   n  i   g    t d d d d d d d	 d
 d d
  }    f d   } | d k r |  j d k r t |  j t j j  r t j	 j
 d d  } n t j	 j d d  } | j |  j   j |  j d j  } n	 |  j } |  j d k	 r.| |  j d f |  j |  n  xB | D]: } | d k	 r5|  j |  }	 | |  j | d |	 q5q5W| d k r|  j d k rt |  j t j j  rt j	 j
 d d  } n t j	 j d d  } | j |  j   j |  j d j  }
 n	 |  j }
 |  j d k	 r2| |  j d f |  j |  n  xH |
 D]@ } | d k	 r9|  j |  } | |  j | d | d | q9q9W|  j d k	 r| |  j d f |  j |  n  xZ |  j D]O } | d k	 r| |  j | d	 |  j j | d
  d |  j j | d
  qqWt  | |  j!  } i  } g  } x   D] } | \ } }  | } | j" d d  i  } x5 |  j# d g D]# } | | k rp| | | | <qpqpW| g  g  d | | } |  j! d k r| d } n  | | | <| j$ |  q-W| |  _% | |  _& d S(   s>   Add labeled artists to represent the different plot semantics.t   brieft   fulls*   `legend` must be 'brief', 'full', or Falset   colort   wR   i    t	   linewidtht   markerR   R   c            sM   |  | f } |  k r,  | j  |   n   j |  t |    | <d  S(   N(   t   updateR@   R=   (   R    t   val_namet   kwsR}   (   R   t   legend_kwargs(    s1   lib/python2.7/site-packages/seaborn/relational.pyR   .  s
    Rv   t   numticksi   t   nbinsR!   t   titleR)   s   .2R   t   labelt   plotN(   R   R   ('   t   legendR4   R=   Rx   R.   Ry   Re   R`   t   LogNormt   tickert
   LogLocatort   MaxNLocatort   tick_valuesR   R1   RK   t   dtypeR   RH   R,   R   R   R   R   R   RI   R   RJ   R   R   RB   R   R8   t   _legend_funct
   setdefaultt   _legend_attributesR@   t   legend_datat   legend_order(   RM   R   t	   verbosityRO   t	   title_kwsR   R   R   t   levelR   R   R)   t   funcR   R   R}   t   _R   R   t   use_kwsRT   t   artist(    (   R   R   s1   lib/python2.7/site-packages/seaborn/relational.pyt   add_legend_data"  sv    	'		#

	(   i   g      ?(   i   i   (   i   i   g      ?i   (   i   i   i   i   (   i   i   i   i   i   i   N(   t   __name__t
   __module__R   Re   t   __version__R   R   R,   RV   Ra   Ru   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR      s,   !				&	'	
				/	W	.				t   _LinePlotterc           B   s   e  Z d  d d d g Z d Z d d d d d d d d d d d d d d d d d d d e d d d d  Z d d  Z d   Z RS(	   R   R   R   R   R   c         C   s   |  j  | | | | | | |  } t j d t j d |  _ |  j | d | | |	  |  j | d |
 | |  |  j | d | | |  | |  _	 | |  _
 | |  _ | |  _ | |  _ | |  _ | d  k r i  n | |  _ | |  _ d  S(   Ng      ?i   s   lines.linewidthR!   R)   R$   (   g      ?i   (   RV   R2   t   r_Re   t   rcParamsR   R   R   R   R+   t	   estimatort   cit   n_bootRc   t	   err_styleR,   t   err_kwsR   (   RM   R   R#   R!   R)   R$   RN   R\   t	   hue_orderRy   R   t
   size_orderR   R   R   t   style_orderR+   R   R   R   Rc   R   R   R   RK   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt   __init__  s    						c   	         sC  |  j   |  j   |  j  t j d d d g d t j        f d   } | j | d |  j } | j	   }   d	 k r | j | d	 f S  d k r | j   } t j t j | | | | f d | j d d d g j   } n | j |  } | j   j   r-| j   j | j  } n d	 } | j | | f S(
   s:   Compute an estimate and confidence interval using grouper.R'   t   lowt   highR   c            sV   t  |   d k r  St |  d  d  } t j |    } t j | d d g  S(   Ni   R   R   R  R  (   R9   R   R   R   R/   R   (   t   valst   bootst   cis(   R   R   R   t   null_ci(    s1   lib/python2.7/site-packages/seaborn/relational.pyt   bootstrapped_cis  s
    Rc   t   sdR&   N(   R   R   R   R/   R   R2   R3   t   groupbyRc   t   aggR,   R'   t   stdR0   t   c_t   stackt   applyRD   RE   t   unstackt   reindex(	   RM   R  t   grouperR+   R	  t   groupedt   estR
  R  (    (   R   R   R   R  s1   lib/python2.7/site-packages/seaborn/relational.pyt	   aggregate  s&    			!
!	c          C   s[  | j  g  g  |  \ } | j d | j    } | j d | j    } | j d | j d | j     } | j d d  } | j d | j d d	   | j d
 | j d d   | j   |  j j   } |  j	 d k r | j d d  nB |  j	 d k rn0 |  j	 d k	 r3d }	 t |	 j |  j	    n  x|  j   D]\ }
 } |
 \ } } } | d | d | j d d  } } } |  j d k	 r|  j d k	 rd }	 t |	   n  |  j | | |  \ } } } n d } |  j j | |  | d <|  j j | |  | d <|  j j | |  | d <|  j j | |  | d <| j  g  g  |  \ } | j   } | j   } | j   } | j   t j |  t j |  } } |  j d k r| j  | | |  \ } nG xD | j   D]6 } t j | | k  } | j  | | | | |  qW| d k	 r@t j | d  t j | d  } } |  j	 d k rx| j | | | d | | q|  j	 d k rt | | f |  } | j | | | d d d | d | | } x< | j   D]+ } y | j |  Wqt  k
 rqXqWqq@q@W|  j! |  |  j" rW|  j# |  | j$   \ } } | rW| j"   qWn  d S(   s6   Draw the plot onto an axes, passing matplotlib kwargs.R   R   R   t   lwR   R   t   markeredgewidtht   mewg      ?t   markeredgecolort   mecR   t   bandt   alphag?t   barss,   `err_style` must be 'band' or 'bars', not {}R   R#   R+   s,   estimator must be None when specifying unitsR  R  t	   linestyleN(%   R   t   popt	   get_colort
   get_markert   get_linewidthR   t   removeR   R5   R   R,   R4   RC   R   RB   R   R+   R  R\   R   R   R   t	   get_alphat   get_solid_capstyleR2   R;   Rd   t   fill_betweenR   t   errorbart   get_childrent   set_capstylet   AttributeErrorR   R   R   t   get_legend_handles_labels(    RM   R   R   t   scoutt
   orig_colort   orig_markert   orig_linewidtht   orig_dashesR   RO   RL   RN   R!   R)   R$   R   R#   R+   t   y_cit   linet
   line_colort
   line_alphat   line_capstylet   uR   R  R  t   y_errt   ebarst   objt   handlesR   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR     sz    	
(!
'			N(	   R   R   R   R   R,   Ri   R  R  R   (    (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR     s   			,t   _ScatterPlotterc           B   sz   e  Z d  d d g Z d Z d d d d d d d d d d d d d d d d d d d d d d d d d d  Z d   Z RS(   R   R   R   t   scatterc         C   s   |  j  | | | | | | |  } t j d t j t j d  |  _ |  j | d | | |	  |  j | d |
 | |  |  j	 | d | d  |  | |  _ | |  _ | |  _ d  S(   Ng      ?i   s   lines.markersizeR!   R)   R$   (   g      ?i   (   RV   R2   R   t   squareRe   R   R   R   R   R   R,   R+   R  R   (   RM   R   R#   R!   R)   R$   RN   R\   R   Ry   R   R   R   R   R   R  t   x_binst   y_binsR+   R   R   R   R  t   x_jittert   y_jitterR   RK   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR  I  s    
$		c         C   sP  | j  g  g  |  } | j d | j    } | j d | j    } | j   | j d d   | j d d  | j d d  |  j r t |  j j	    d } | j d	 |  n  |  j
 d
 k r d n |  j
 | d <|  j |  j j   } | j s d  S| d } | d }	 |  j rBg  | d D] }
 |  j j |
  ^ q!} n  |  j rwg  | d D] }
 |  j j |
  ^ qV} n  t j |  t j |	  t j |  t j |  f } | j  | |   } |  j rg  | d D] }
 |  j j |
  ^ q} | j |  n  |  j |  |  j rL|  j |  | j   \ } } | rL| j   qLn  d  S(   NR   t   cR   R   g      ?t	   edgecolorR   i    R   t   autoi   R  R   R#   R!   R)   R$   (   R=  R   t	   get_sizest   get_facecolorsR$  R,   R   R   RY   R   R  RK   RL   Rp   R)   R\   RB   R   R2   R;   R   t	   set_pathsR   R   R   R,  (   RM   R   R   R-  R   RC  t   example_markerRN   R   R#   R   Rs   t   pointsR   R;  R   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR   d  s>    
	"	

	,	,6	)	N(   R   R   R   R   R,   R  R   (    (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR<  D  s   				t   main_api_narratives      The relationship between ``x`` and ``y`` can be shown for different subsets
    of the data using the ``hue``, ``size``, and ``style`` parameters. These
    parameters control what visual semantics are used to identify the different
    subsets. It is possible to show up to three dimensions independently by
    using all three semantic types, but this style of plot can be hard to
    interpret and is often ineffective. Using redundant semantics (i.e. both
    ``hue`` and ``style`` for the same variable) can be helpful for making
    graphics more accessible.

    See the :ref:`tutorial <relational_tutorial>` for more information.    t	   data_varss       x, y : names of variables in ``data`` or vector data, optional
        Input data variables; must be numeric. Can pass data directly or
        reference columns in ``data``.    RN   s      data : DataFrame, array, or list of arrays, optional
        Input data structure. If ``x`` and ``y`` are specified as names, this
        should be a "long-form" DataFrame containing those columns. Otherwise
        it is treated as "wide-form" data and grouping variables are ignored.
        See the examples for the various ways this parameter can be specified
        and the different effects of each.    R\   sp      palette : string, list, dict, or matplotlib colormap
        An object that determines how colors are chosen when ``hue`` is used.
        It can be the name of a seaborn palette or matplotlib colormap, a list
        of colors (anything matplotlib understands), a dict mapping levels
        of the ``hue`` variable to colors, or a matplotlib colormap object.    R   s       hue_order : list, optional
        Specified order for the appearance of the ``hue`` variable levels,
        otherwise they are determined from the data. Not relevant when the
        ``hue`` variable is numeric.    Ry   s       hue_norm : tuple or Normalize object, optional
        Normalization in data units for colormap applied to the ``hue``
        variable when it is numeric. Not relevant if it is categorical.    R   s      sizes : list, dict, or tuple, optional
        An object that determines how sizes are chosen when ``size`` is used.
        It can always be a list of size values or a dict mapping levels of the
        ``size`` variable to sizes. When ``size``  is numeric, it can also be
        a tuple specifying the minimum and maximum size to use such that other
        values are normalized within this range.    R   s       size_order : list, optional
        Specified order for appearance of the ``size`` variable levels,
        otherwise they are determined from the data. Not relevant when the
        ``size`` variable is numeric.    R   s       size_norm : tuple or Normalize object, optional
        Normalization in data units for scaling plot objects when the
        ``size`` variable is numeric.    R   s      markers : boolean, list, or dictionary, optional
        Object determining how to draw the markers for different levels of the
        ``style`` variable. Setting to ``True`` will use default markers, or
        you can pass a list of markers or a dictionary mapping levels of the
        ``style`` variable to markers. Setting to ``False`` will draw
        marker-less lines.  Markers are specified as in matplotlib.    R  s       style_order : list, optional
        Specified order for appearance of the ``style`` variable levels
        otherwise they are determined from the data. Not relevant when the
        ``style`` variable is numeric.    R+   sE      units : {long_form_var}
        Grouping variable identifying sampling units. When used, a separate
        line will be drawn for each unit with appropriate semantics, but no
        legend entry will be added. Useful for showing distribution of
        experimental replicates when exact identities are not needed.
    R   s       estimator : name of pandas method or callable or None, optional
        Method for aggregating across multiple observations of the ``y``
        variable at the same ``x`` level. If ``None``, all observations will
        be drawn.    R   s       ci : int or "sd" or None, optional
        Size of the confidence interval to draw when aggregating with an
        estimator. "sd" means to draw the standard deviation of the data.
        Setting to ``None`` will skip bootstrapping.    R   si       n_boot : int, optional
        Number of bootstraps to use for computing the confidence interval.    R   sP      legend : "brief", "full", or False, optional
        How to draw the legend. If "brief", numeric ``hue`` and ``size``
        variables will be represented with a sample of evenly spaced values.
        If "full", every group will get an entry in the legend. If ``False``,
        no legend data is added and no legend is drawn.    t   ax_insr       ax : matplotlib Axes, optional
        Axes object to draw the plot onto, otherwise uses the current Axes.    t   ax_outsY       ax : matplotlib Axes
        Returns the Axes object with the plot drawn onto it.    t   long_form_vars6   name of variables in ``data`` or vector data, optionalt   meani_   i  R  R   c      /   K   s   t  d |  d | d | d | d | d | d | d | d	 | d
 |	 d |
 d | d | d | d | d | d | d | d | d | d | d | d |  } | d  k r t j   } n  | j | |  | S(   NR   R#   R!   R)   R$   RN   R\   R   Ry   R   R   R   R   R   R  R+   R   R   R   Rc   R   R   R   (   R   R,   t   pltt   gcaR   (   R   R#   R!   R)   R$   RN   R\   R   Ry   R   R   R   R   R   R  R+   R   R   R   Rc   R   R   R   R   Rt   R   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR   (  s    $s4      Draw a line plot with possibility of several semantic groupings.

    {main_api_narrative}

    By default, the plot aggregates over multiple ``y`` values at each value of
    ``x`` and shows an estimate of the central tendency and a confidence
    interval for that estimate.

    Parameters
    ----------
    {data_vars}
    hue : {long_form_var}
        Grouping variable that will produce lines with different colors.
        Can be either categorical or numeric, although color mapping will
        behave differently in latter case.
    size : {long_form_var}
        Grouping variable that will produce lines with different widths.
        Can be either categorical or numeric, although size mapping will
        behave differently in latter case.
    style : {long_form_var}
        Grouping variable that will produce lines with different dashes
        and/or markers. Can have a numeric dtype but will always be treated
        as categorical.
    {data}
    {palette}
    {hue_order}
    {hue_norm}
    {sizes}
    {size_order}
    {size_norm}
    dashes : boolean, list, or dictionary, optional
        Object determining how to draw the lines for different levels of the
        ``style`` variable. Setting to ``True`` will use default dash codes, or
        you can pass a list of dash codes or a dictionary mapping levels of the
        ``style`` variable to dash codes. Setting to ``False`` will use solid
        lines for all subsets. Dashes are specified as in matplotlib: a tuple
        of ``(segment, gap)`` lengths, or an empty string to draw a solid line.
    {markers}
    {style_order}
    {units}
    {estimator}
    {ci}
    {n_boot}
    sort : boolean, optional
        If True, the data will be sorted by the x and y variables, otherwise
        lines will connect points in the order they appear in the dataset.
    err_style : "band" or "bars", optional
        Whether to draw the confidence intervals with translucent error bands
        or discrete error bars.
    err_band : dict of keyword arguments
        Additional paramters to control the aesthetics of the error bars. The
        kwargs are passed either to ``ax.fill_between`` or ``ax.errorbar``,
        depending on the ``err_style``.
    {legend}
    {ax_in}
    kwargs : key, value mappings
        Other keyword arguments are passed down to ``plt.plot`` at draw time.

    Returns
    -------
    {ax_out}

    See Also
    --------
    scatterplot : Show the relationship between two variables without
                  emphasizing continuity of the ``x`` variable.
    pointplot : Show the relationship between two variables when one is
                categorical.

    Examples
    --------

    Draw a single line plot with error bands showing a confidence interval:

    .. plot::
        :context: close-figs

        >>> import seaborn as sns; sns.set()
        >>> import matplotlib.pyplot as plt
        >>> fmri = sns.load_dataset("fmri")
        >>> ax = sns.lineplot(x="timepoint", y="signal", data=fmri)

    Group by another variable and show the groups with different colors:


    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(x="timepoint", y="signal", hue="event",
        ...                   data=fmri)

    Show the grouping variable with both color and line dashing:

    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(x="timepoint", y="signal",
        ...                   hue="event", style="event", data=fmri)

    Use color and line dashing to represent two different grouping variables:

    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(x="timepoint", y="signal",
        ...                   hue="region", style="event", data=fmri)

    Use markers instead of the dashes to identify groups:

    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(x="timepoint", y="signal",
        ...                   hue="event", style="event",
        ...                   markers=True, dashes=False, data=fmri)

    Show error bars instead of error bands and plot the standard error:

    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(x="timepoint", y="signal", hue="event",
        ...                   err_style="bars", ci=68, data=fmri)

    Show experimental replicates instead of aggregating:

    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(x="timepoint", y="signal", hue="event",
        ...                   units="subject", estimator=None, lw=1,
        ...                   data=fmri.query("region == 'frontal'"))

    Use a quantitative color mapping:

    .. plot::
        :context: close-figs

        >>> dots = sns.load_dataset("dots").query("align == 'dots'")
        >>> ax = sns.lineplot(x="time", y="firing_rate",
        ...                   hue="coherence", style="choice",
        ...                   data=dots)

    Use a different normalization for the colormap:

    .. plot::
        :context: close-figs

        >>> from matplotlib.colors import LogNorm
        >>> ax = sns.lineplot(x="time", y="firing_rate",
        ...                   hue="coherence", style="choice",
        ...                   hue_norm=LogNorm(), data=dots)

    Use a different color palette:

    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(x="time", y="firing_rate",
        ...                   hue="coherence", style="choice",
        ...                   palette="ch:2.5,.25", data=dots)

    Use specific color values, treating the hue variable as categorical:

    .. plot::
        :context: close-figs

        >>> palette = sns.color_palette("mako_r", 6)
        >>> ax = sns.lineplot(x="time", y="firing_rate",
        ...                   hue="coherence", style="choice",
        ...                   palette=palette, data=dots)

    Change the width of the lines with a quantitative variable:

    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(x="time", y="firing_rate",
        ...                   size="coherence", hue="choice",
        ...                   legend="full", data=dots)

    Change the range of line widths used to normalize the size variable:

    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(x="time", y="firing_rate",
        ...                   size="coherence", hue="choice",
        ...                   sizes=(.25, 2.5), data=dots)

    Plot from a wide-form DataFrame:

    .. plot::
        :context: close-figs

        >>> import numpy as np, pandas as pd; plt.close("all")
        >>> index = pd.date_range("1 1 2000", periods=100,
        ...                       freq="m", name="date")
        >>> data = np.random.randn(100, 4).cumsum(axis=0)
        >>> wide_df = pd.DataFrame(data, index, ["a", "b", "c", "d"])
        >>> ax = sns.lineplot(data=wide_df)

    Plot from a list of Series:

    .. plot::
        :context: close-figs

        >>> list_data = [wide_df.loc[:"2005", "a"], wide_df.loc["2003":, "b"]]
        >>> ax = sns.lineplot(data=list_data)

    Plot a single Series, pass kwargs to ``plt.plot``:

    .. plot::
        :context: close-figs

        >>> ax = sns.lineplot(data=wide_df["a"], color="coral", label="line")

    Draw lines at points as they appear in the dataset:

    .. plot::
        :context: close-figs

        >>> x, y = np.random.randn(2, 5000).cumsum(axis=1)
        >>> ax = sns.lineplot(x=x, y=y, sort=False, lw=1)


    RE  c      /   K   s   t  d |  d | d | d | d | d | d | d | d	 | d
 |	 d |
 d | d | d | d | d | d | d | d | d | d | d | d |  } | d  k r t j   } n  | j | |  | S(   NR   R#   R!   R$   R)   RN   R\   R   Ry   R   R   R   R   R  R?  R@  R   R   R   R  RA  RB  R   (   R<  R,   RQ  RR  R   (   R   R#   R!   R$   R)   RN   R\   R   Ry   R   R   R   R   R  R?  R@  R+   R   R   R   R  RA  RB  R   R   Rt   R   (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR   '  s    	$s      Draw a scatter plot with possibility of several semantic groupings.

    {main_api_narrative}

    Parameters
    ----------
    {data_vars}
    hue : {long_form_var}
        Grouping variable that will produce points with different colors.
        Can be either categorical or numeric, although color mapping will
        behave differently in latter case.
    size : {long_form_var}
        Grouping variable that will produce points with different sizes.
        Can be either categorical or numeric, although size mapping will
        behave differently in latter case.
    style : {long_form_var}
        Grouping variable that will produce points with different markers.
        Can have a numeric dtype but will always be treated as categorical.
    {data}
    {palette}
    {hue_order}
    {hue_norm}
    {sizes}
    {size_order}
    {size_norm}
    {markers}
    {style_order}
    {{x,y}}_bins : lists or arrays or functions
        *Currently non-functional.*
    {units}
        *Currently non-functional.*
    {estimator}
        *Currently non-functional.*
    {ci}
        *Currently non-functional.*
    {n_boot}
        *Currently non-functional.*
    alpha : float
        Proportional opacity of the points.
    {{x,y}}_jitter : booleans or floats
        *Currently non-functional.*
    {legend}
    {ax_in}
    kwargs : key, value mappings
        Other keyword arguments are passed down to ``plt.scatter`` at draw
        time.

    Returns
    -------
    {ax_out}

    See Also
    --------
    lineplot : Show the relationship between two variables connected with
               lines to emphasize continuity.
    swarmplot : Draw a scatter plot with one categorical variable, arranging
                the points to show the distribution of values.

    Examples
    --------

    Draw a simple scatter plot between two variables:

    .. plot::
        :context: close-figs

        >>> import seaborn as sns; sns.set()
        >>> import matplotlib.pyplot as plt
        >>> tips = sns.load_dataset("tips")
        >>> ax = sns.scatterplot(x="total_bill", y="tip", data=tips)

    Group by another variable and show the groups with different colors:

    .. plot::
        :context: close-figs

        >>> ax = sns.scatterplot(x="total_bill", y="tip", hue="time",
        ...                      data=tips)

    Show the grouping variable by varying both color and marker:

    .. plot::
        :context: close-figs

        >>> ax = sns.scatterplot(x="total_bill", y="tip",
        ...                      hue="time", style="time", data=tips)

    Vary colors and markers to show two different grouping variables:

    .. plot::
        :context: close-figs

        >>> ax = sns.scatterplot(x="total_bill", y="tip",
        ...                      hue="day", style="time", data=tips)

    Show a quantitative variable by varying the size of the points:

    .. plot::
        :context: close-figs

        >>> ax = sns.scatterplot(x="total_bill", y="tip", size="size",
        ...                      data=tips)

    Also show the quantitative variable by also using continuous colors:

    .. plot::
        :context: close-figs

        >>> ax = sns.scatterplot(x="total_bill", y="tip",
        ...                      hue="size", size="size",
        ...                      data=tips)

    Use a different continuous color map:

    .. plot::
        :context: close-figs

        >>> cmap = sns.cubehelix_palette(dark=.3, light=.8, as_cmap=True)
        >>> ax = sns.scatterplot(x="total_bill", y="tip",
        ...                      hue="size", size="size",
        ...                      palette=cmap,
        ...                      data=tips)

    Change the minimum and maximum point size and show all sizes in legend:

    .. plot::
        :context: close-figs

        >>> cmap = sns.cubehelix_palette(dark=.3, light=.8, as_cmap=True)
        >>> ax = sns.scatterplot(x="total_bill", y="tip",
        ...                      hue="size", size="size",
        ...                      sizes=(20, 200), palette=cmap,
        ...                      legend="full", data=tips)

    Use a narrower range of color map intensities:

    .. plot::
        :context: close-figs

        >>> cmap = sns.cubehelix_palette(dark=.3, light=.8, as_cmap=True)
        >>> ax = sns.scatterplot(x="total_bill", y="tip",
        ...                      hue="size", size="size",
        ...                      sizes=(20, 200), hue_norm=(0, 7),
        ...                      legend="full", data=tips)

    Vary the size with a categorical variable, and use a different palette:

    .. plot::
        :context: close-figs

        >>> cmap = sns.cubehelix_palette(dark=.3, light=.8, as_cmap=True)
        >>> ax = sns.scatterplot(x="total_bill", y="tip",
        ...                      hue="day", size="smoker",
        ...                      palette="Set2",
        ...                      data=tips)

    Use a specific set of markers:

    .. plot::
        :context: close-figs

        >>> markers = {{"Lunch": "s", "Dinner": "X"}}
        >>> ax = sns.scatterplot(x="total_bill", y="tip", style="time",
        ...                      markers=markers,
        ...                      data=tips)

    Control plot attributes using matplotlib parameters:

    .. plot::
        :context: close-figs

        >>> ax = sns.scatterplot(x="total_bill", y="tip",
        ...                      s=100, color=".2", marker="+",
        ...                      data=tips)

    Pass data vectors instead of names in a data frame:

    .. plot::
        :context: close-figs

        >>> iris = sns.load_dataset("iris")
        >>> ax = sns.scatterplot(x=iris.sepal_length, y=iris.sepal_width,
        ...                      hue=iris.species, style=iris.species)

    Pass a wide-form dataset and plot against its index:

    .. plot::
        :context: close-figs

        >>> import numpy as np, pandas as pd; plt.close("all")
        >>> index = pd.date_range("1 1 2000", periods=100,
        ...                       freq="m", name="date")
        >>> data = np.random.randn(100, 4).cumsum(axis=0)
        >>> wide_df = pd.DataFrame(data, index, ["a", "b", "c", "d"])
        >>> ax = sns.scatterplot(data=wide_df)

    R=  i   c       !   K   s"  | d k r3 t  } t } | d  k r* t n | } nN | d k rf t } t } | d  k r] t n | } n d j |  } t |   | d |  d | d | d | d | d	 | d
 | d | d | d | d | d | d | d | d | d |  } | j r | j n d  } t	 | j
  r| j
 n d  } | j d  k	 r8| j n d  } | j rP| j n d  } t	 | j  rn| j n d  } | j d  k	 r| j n d  } | j r| j n d  } | j r| j n d  } t	 | j  r| j n d  } t d
 | d | d | j d | d | d | j d | d | d | d t  
} | j |  | d k rT| j d  n  | d  k rfi  n | } t d	 | d | d | d | d |	 d |
 d | d | d t |  	} | j | |  | d | d | d | | | r| j | j j d  | j r| j d | j d | j  qn  | S(   NR=  R3  s   Plot kind {} not recognizedR   R#   R!   R)   R$   RN   R\   R   Ry   R   R   R   R   R   R  R   t   rowt   colt   col_wrapt	   row_ordert	   col_ordert   heightt   aspectRp   i    R   t   label_order(   R<  R   R,   Ri   R   R   RC   R4   R\   RE   R   Ry   R   R   R   R   R   R   R=   t   FalseR   R   R   t   map_dataframeR   t   axest   flatR   t
   add_legendR   (    R   R#   R!   R)   R$   RN   RS  RT  RU  RV  RW  R\   R   Ry   R   R   R   R   R   R  R   t   kindRX  RY  t	   facet_kwsRt   t   plotterR   RO   R   t   plot_kwst   g(    (    s1   lib/python2.7/site-packages/seaborn/relational.pyR   
  s`    $				s      Figure-level interface for drawing relational plots onto a FacetGrid.

    This function provides access to several different axes-level functions
    that show the relationship between two variables with semantic mappings
    of subsets. The ``kind`` parameter selects the underlying axes-level
    function to use:

    - :func:`scatterplot` (with ``kind="scatter"``; the default)
    - :func:`lineplot` (with ``kind="line"``)

    Extra keyword arguments are passed to the underlying function, so you
    should refer to the documentation for each to see kind-specific options.

    {main_api_narrative}

    After plotting, the :class:`FacetGrid` with the plot is returned and can
    be used directly to tweak supporting plot details or add other layers.

    Note that, unlike when using the underlying plotting functions directly,
    data must be passed in a long-form DataFrame with variables specified by
    passing strings to ``x``, ``y``, and other parameters.

    Parameters
    ----------
    x, y : names of variables in ``data``
        Input data variables; must be numeric.
    hue : name in ``data``, optional
        Grouping variable that will produce elements with different colors.
        Can be either categorical or numeric, although color mapping will
        behave differently in latter case.
    size : name in ``data``, optional
        Grouping variable that will produce elements with different sizes.
        Can be either categorical or numeric, although size mapping will
        behave differently in latter case.
    style : name in ``data``, optional
        Grouping variable that will produce elements with different styles.
        Can have a numeric dtype but will always be treated as categorical.
    {data}
    row, col : names of variables in ``data``, optional
        Categorical variables that will determine the faceting of the grid.
    {col_wrap}
    row_order, col_order : lists of strings, optional
        Order to organize the rows and/or columns of the grid in, otherwise the
        orders are inferred from the data objects.
    {palette}
    {hue_order}
    {hue_norm}
    {sizes}
    {size_order}
    {size_norm}
    {legend}
    kind : string, optional
        Kind of plot to draw, corresponding to a seaborn relational plot.
        Options are {{``scatter`` and ``line``}}.
    {height}
    {aspect}
    facet_kws : dict, optional
        Dictionary of other keyword arguments to pass to :class:`FacetGrid`.
    kwargs : key, value pairings
        Other keyword arguments are passed through to the underlying plotting
        function.

    Returns
    -------
    g : :class:`FacetGrid`
        Returns the :class:`FacetGrid` object with the plot on it for further
        tweaking.

    Examples
    --------

    Draw a single facet to use the :class:`FacetGrid` legend placement:

    .. plot::
        :context: close-figs

        >>> import seaborn as sns
        >>> sns.set(style="ticks")
        >>> tips = sns.load_dataset("tips")
        >>> g = sns.relplot(x="total_bill", y="tip", hue="day", data=tips)

    Facet on the columns with another variable:

    .. plot::
        :context: close-figs

        >>> g = sns.relplot(x="total_bill", y="tip",
        ...                 hue="day", col="time", data=tips)

    Facet on the columns and rows:

    .. plot::
        :context: close-figs

        >>> g = sns.relplot(x="total_bill", y="tip", hue="day",
        ...                 col="time", row="sex", data=tips)

    "Wrap" many column facets into multiple rows:

    .. plot::
        :context: close-figs

        >>> g = sns.relplot(x="total_bill", y="tip", hue="time",
        ...                 col="day", col_wrap=2, data=tips)

    Use multiple semantic variables on each facet with specified attributes:

    .. plot::
        :context: close-figs

        >>> g = sns.relplot(x="total_bill", y="tip", hue="time", size="size",
        ...                 palette=["b", "r"], sizes=(10, 100),
        ...                 col="time", data=tips)

    Use a different kind of plot:

    .. plot::
        :context: close-figs

        >>> fmri = sns.load_dataset("fmri")
        >>> g = sns.relplot(x="timepoint", y="signal",
        ...                 hue="event", style="event", col="region",
        ...                 kind="line", data=fmri)

    Change the size of each facet:

    .. plot::
        :context: close-figs

        >>> g = sns.relplot(x="timepoint", y="signal",
        ...                 hue="event", style="event", col="region",
        ...                 height=5, aspect=.7, kind="line", data=fmri)

    (2   t
   __future__R    t	   itertoolsR   t   textwrapR   t   distutils.versionR   t   numpyR2   t   pandasR/   t
   matplotlibRe   t   matplotlib.pyplott   pyplotRQ  t   external.sixR   R   R   R   R   R   R	   R
   t
   algorithmsR   t   palettesR   R   R   t   axisgridR   R   t   __all__t   objectR   R   R<  R=   t   _relational_docsR   R,   Ri   R   RC   t   __doc__R   R   (    (    (    s1   lib/python2.7/site-packages/seaborn/relational.pyt   <module>   s   (  sc																													I