3
h*                 @   s:  d dl 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mZmZmZ ddlmZ ddlmZmZ ddlmZ ddlmZmZ d	d
dgZeedddZedddddddddddddddddd d!d"Zej ed# eeeed$Z!G d%d& d&eZ"G d'd( d(e"Z#G d)d* d*e"Z$eddddddddddddd+dddd,d-d.dd+d/dd0dd1d2dZ%d3j&ee!ed4 ed5 d6e%_'eddddddddddddd+dddddd-d.dddd0dd7d8d
Z(d9j&ee!ed4 ed5 d6e(_'eddddddddddddddddddddd0d:d;dddd<d=d	Z)d>j&ee!ed4 ed5 d6e)_'dS )?    N   )VectorPlotter)ci_to_errsizelocator_to_legend_entriesadjust_legend_subtitlesci)	bootstrap)	FacetGrid_facet_docs)_deprecate_positional_args)DocstringComponents
_core_docsrelplotscatterplotlineplotac  
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.
    a  
The default treatment of the ``hue`` (and to a lesser extent, ``size``)
semantic, if present, depends on whether the variable is inferred to
represent "numeric" or "categorical" data. In particular, numeric variables
are represented with a sequential colormap by default, and the legend
entries show regular "ticks" with values that may or may not exist in the
data. This behavior can be controlled through various parameters, as
described and illustrated below.
    )Zmain_apiZrelational_semanticz
x, y : names of variables in ``data`` or vector data
    Input data variables; must be numeric. Can pass data directly or
    reference columns in ``data``.
    a  
data : DataFrame, array, or list of arrays
    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.
    a^  
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.
    z
hue_order : list
    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.
    z
hue_norm : tuple or :class:`matplotlib.colors.Normalize` object
    Normalization in data units for colormap applied to the ``hue``
    variable when it is numeric. Not relevant if it is categorical.
    ay  
sizes : list, dict, or tuple
    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.
    z
size_order : list
    Specified order for appearance of the ``size`` variable levels,
    otherwise they are determined from the data. Not relevant when the
    ``size`` variable is numeric.
    z
size_norm : tuple or Normalize object
    Normalization in data units for scaling plot objects when the
    ``size`` variable is numeric.
    a  
dashes : boolean, list, or dictionary
    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.
    a  
markers : boolean, list, or dictionary
    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.
    z
style_order : list
    Specified order for appearance of the ``style`` variable levels
    otherwise they are determined from the data. Not relevant when the
    ``style`` variable is numeric.
    a<  
units : vector or key in ``data``
    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.
    z
estimator : name of pandas method or callable or None
    Method for aggregating across multiple observations of the ``y``
    variable at the same ``x`` level. If ``None``, all observations will
    be drawn.
    z
ci : int or "sd" or None
    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.
    zY
n_boot : int
    Number of bootstraps to use for computing the confidence interval.
    z
seed : int, numpy.random.Generator, or numpy.random.RandomState
    Seed or random number generator for reproducible bootstrapping.
    a  
legend : "auto", "brief", "full", or False
    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 "auto",
    choose between brief or full representation based on number of levels.
    If ``False``, no legend data is added and no legend is drawn.
    zb
ax : matplotlib Axes
    Axes object to draw the plot onto, otherwise uses the current Axes.
    zS
ax : matplotlib Axes
    Returns the Axes object with the plot drawn onto it.
    )Z	data_varsdatapalette	hue_orderhue_normsizes
size_order	size_normdashesmarkersstyle_orderunits	estimatorr   n_bootseedlegendZax_inZax_outparams)coreZfacetsrelc               @   s&   e Zd ZdddddZdZdd ZdS )	_RelationalPlotterz@indexz@valuesz@columns)xyhuestyleTc                 sj  j }t|tr&|d%kr&d}t|n|dkr2d}i g  dd fdd	d&D D }t|dkrl|j }nd}tddddddd} fdd}d}jjdko|dkp|dkotjj	|k}	|	r.tjj
tjjrtjj|d}
ntjj|d}
tjj	tjj	f}t|
|jd
 j j\}}n$jj	dkrFg  }}njj	 }}| rjjd
ddk	r|jd
 dfjd
 f| x@t||D ]2\}}|dk	rj|}|jd
 ||d qW jjdko|dkp|dkotjj	|k}|rntjj
tjjr*tjj|d}
ntjj|d}
tjj	tjj	f}t|
|jd j j\}}n$jj	dkrg  }}njj	 }}| r̈jjdddk	r|jd dfjd f| xBt||D ]4\}}|dk	r؈j|}|jd |||d qW | rJjjdddk	rJ|jd dfjd f| jj	dk	rxLjj	D ]@}|dk	rbj|}|jd ||jdd|jddd qbW t|j}i }g }x D ]}|\}}| }|jd d! i }x,jd"g D ]}||kr|| ||< qW |g g fd#|i|}jd$kr<|d }|||< |j | qW |_!|_"|_#dS )'z>Add labeled artists to represent the different plot semantics.autobrieffullz7`legend` must be 'auto', 'brief', 'full', or a boolean.Tc             S   s   h | ]}|d k	r|qS )N ).0titler+   r+   5/tmp/pip-build-riy7u7_k/seaborn/seaborn/relational.py	<setcomp>   s   z5_RelationalPlotter.add_legend_data.<locals>.<setcomp>c             3   s   | ]} j j|d V  qd S )N)	variablesget)r,   v)selfr+   r.   	<genexpr>   s    z5_RelationalPlotter.add_legend_data.<locals>.<genexpr>r&   sizer'   r    Fwr   )visiblecolors	linewidthmarkerr   c                s>   | |f}|kr"| j f | n j| tf ||< d S )N)updateappenddict)var_nameZval_namekwskey)keyslegend_kwargsr+   r.   r=      s
    
z2_RelationalPlotter.add_legend_data.<locals>.update   numeric)Znumticks)ZnbinsNr-   )r9   )r;   r:   r<   r   )r<   r   r9   z.2r8   labelplot)r(   r)   r*   )r&   r5   r'   )$r   
isinstancestr
ValueErrorlenpopr?   _hue_mapZmap_typelevelsnormmplcolorsZLogNormZtickerZ
LogLocatorZMaxNLocatorminmaxr   	plot_dataZinfer_objectsdtyper0   r1   zip	_size_map
_style_mapgetattr_legend_func
setdefault_legend_attributesr>   legend_titlelegend_datalegend_order) r3   ax	verbosityerrtitlesr^   Z	title_kwsr=   Zbrief_ticksZ	brief_huelocatorZlimitsZ
hue_levelsZhue_formatted_levelslevelZformatted_levelr9   Z
brief_sizeZsize_levelsZsize_formatted_levelsr5   attrsfuncr_   r`   rB   _rG   rA   Zuse_kwsattrZartistr+   )rC   rD   r3   r.   add_legend_data   s    













z"_RelationalPlotter.add_legend_dataN)__name__
__module____qualname__Zwide_structuresortrk   r+   r+   r+   r.   r#      s   r#   c                   sV   e Zd ZddddgZdZdi ddddddddd
 fd	d

ZdddZdd Z  ZS )_LinePlotterr9   r;   r<   r   rH   NT)
r   r0   r   r   r   r   ro   	err_styleerr_kwsr   c   
            sf   t jd tjd  | _t j||d || _|| _|| _	|| _
|| _|| _|	d krVi n|	| _|
| _d S )N      ?   zlines.linewidth)r   r0   )rs   rt   )npr_rQ   rcParams_default_size_rangesuper__init__r   r   r   r   ro   rq   rr   r   )r3   r   r0   r   r   r   r   ro   rq   rr   r   )	__class__r+   r.   rz   a  s    z_LinePlotter.__init__c       	         s   | j | j | j| jtjddgtd fdd}|j|| jd}|j	} dkrl|j
|dfS  dkr|j }tjtj|| || f |j
ddgd	j }n
|j|}|j j r|j j|j
}nd}|j
||fS )
z:Compute an estimate and confidence interval using grouper.lowhigh)indexrV   c                s:   t | dkrS t| d}t| }tj|ddgS )Nr   )rh   r   r   r|   r}   )rL   r   ci_funcpdSeries)valsZbootscis)r   rh   r   null_cir   r+   r.   bootstrapped_cis  s
    
z0_LinePlotter.aggregate.<locals>.bootstrapped_cis)ro   Nsd)r~   columns)r   r   r   r   r   r   floatgroupbyro   Zaggr~   Zstd	DataFrameru   Zc_stackapplyZnotnullanyZunstackZreindex)	r3   r   Zgrouperr   r   ZgroupedZestr   r   r+   )r   rh   r   r   r   r.   	aggregate{  s(    


z_LinePlotter.aggregatec       #         s  |j g g f|\}|jd|j }|jd|j }|jd|jd|j }|jd|jdd}|jd|jd	d
 |jd|jdd |j   jj } j	dkr|jdd n* j	dkrn j	dk	rd}	t
|	j j	|jt||||d d&}
x j|
ddD ]\}} jr>dddg} fdd|D }|j|}|j }tj|jtd}|jd|}|jd|}|jd|} jdk	rd jkrd}	t
|	 j|||\}}}nd}d|krԈ j|d |d< d|kr j|d |d< d|kr4 j|d }d |kr|d  |d < d|kr4|d |d< |j g g f|\}|j }|j }|j }|j  tj |tj | }}d jkrxL|j! D ],}tj ||k}|j || || f| qW n|j ||f|\}|dk	rtj |d! tj |d"  }} j	dkr&|j"|||fd|i| nr j	dkrt#||f|}|j$|||fd#||d$|}x8|j% D ],}y|j&| W n t'k
r   Y nX qhW qW  j(|  j)r j*| |j+ \} }!| r|j) j,d%}"t-|" dS )'z6Draw the plot onto an axes, passing matplotlib kwargs.r9   r<   r;   Zlw	linestyleZlsNZmarkeredgewidthZmewg      ?ZmarkeredgecolorZmecr7   bandalphag?Zbarsz,`err_style` must be 'band' or 'bars', not {})r9   r<   r;   r   r&   r5   r'   T)Zfrom_comp_datar   r$   r%   c                s   g | ]}| j kr|qS r+   )r0   )r,   var)r3   r+   r.   
<listcomp>  s    z%_LinePlotter.plot.<locals>.<listcomp>)r~   rV   z,estimator must be None when specifying unitsr   r|   r}   r6   )r   r9   r   )r-   )r&   r5   r'   ).rH   rM   Z	get_colorZ
get_markerZget_linewidthr\   removerr   copyrq   rK   formatr=   r?   Z	iter_dataro   Zsort_valuesdropnar   r   r~   r   r1   r   r0   r   rN   rX   rY   Z	get_alphaZget_solid_capstyleru   asarrayuniqueZfill_betweenr   ZerrorbarZget_childrenZset_capstyleAttributeError_add_axis_labelsr   rk   get_legend_handles_labelsr^   r   )#r3   ra   rA   scoutZ
orig_colorZorig_markerZorig_linewidthZorig_linestylerr   rc   Zgrouping_varsZsub_varsZsub_dataZ	sort_varsZ	sort_colsnullr$   r%   uZy_ci
attributeslineZ
line_colorZ
line_alphaZline_capstyleZu_iZrowsr|   r}   Zy_errZebarsobjhandlesri   r   r+   )r3   r.   rH     s    











 


z_LinePlotter.plot)N)	rl   rm   rn   r]   r[   rz   r   rH   __classcell__r+   r+   )r{   r.   rp   \  s   
-rp   c                   sL   e Zd ZdddgZdZdi dddddddddd fdd
Zd	d
 Z  ZS )_ScatterPlotterr9   r:   r<   scatterN)r   r0   x_binsy_binsr   r   r   r   x_jittery_jitterr   c               s<   t jd t jtjd  | _t j||d || _|| _	d S )N      ?rt   zlines.markersize)r   r0   )r   rt   )
ru   rv   ZsquarerQ   rw   rx   ry   rz   r   r   )r3   r   r0   r   r   r   r   r   r   r   r   r   )r{   r+   r.   rz   ;  s    z_ScatterPlotter.__init__c                sV  t tj|jdg jd tj|jdg jd }tj|tj }}|j||f|}|jd|j	 }|jd|j
 }|j  |jdd   jt j j }	|	jsd S tjt|	tj}
|	jd|
}|	jd|
}d jkr j|	d }d jkr j|	d }|jd	d
tjtj|d  d jkrP jjd } j|d}|jd| |jdtjjdd}t|tjjstjj|}|j r|jdd  jdkrdn j|d< tj |tj |tj |tj |f}|j||}d jkr fdd|	d D }|j!|  j"|  j#rR j$| |j% \}}|rR|j# j&d}t'| d S )Nr:   r   cr9   r$   r%   r&   r5   r;   g{Gz?
   r'   r<   oZ	edgecolorr7   r(   r   r   c                s   g | ]} j |d qS )path)rY   )r,   val)r3   r+   r.   r     s    z(_ScatterPlotter.plot.<locals>.<listcomp>)r-   )(rT   ru   Z
atleast_1dr1   shaper*   nanr   rM   Z	get_sizesZget_facecolorsr   rU   listr0   r   r5   rL   rN   rX   r\   sqrtZ
percentilerY   rO   rQ   rw   rI   r   ZMarkerStyleZ	is_filledr   r   Z	set_pathsr   r   rk   r   r^   r   )r3   ra   rA   Z
scout_sizeZscout_xZscout_yr   r:   r   r   emptyr$   r%   Zexample_levelZexample_markermargsZpointspr   ri   r   r+   )r3   r.   rH   P  sT    

$


z_ScatterPlotter.plot)rl   rm   rn   r]   r[   rz   rH   r   r+   r+   )r{   r.   r   6  s   
r   TZmean_   i  r   r(   )r$   r%   r&   r5   r'   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ro   rq   rr   r   ra   c             K   s   t jt }t ||||||||||d
}|j|||d |j|	|
|d |j|||d |d krhtj }|jsr|S |j	| |j
|| |S )N)
r   r0   r   r   r   r   ro   rq   rr   r   )r   orderrP   )r   r   rP   )r   r   r   )rp   get_semanticslocalsmap_huemap_size	map_stylepltgcahas_xy_data_attachrH   )r$   r%   r&   r5   r'   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ro   rq   rr   r   ra   kwargsr0   r   r+   r+   r.   r     s    
aD  Draw a line plot with possibility of several semantic groupings.

{narrative.main_api}

{narrative.relational_semantic}

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
----------
{params.core.xy}
hue : vector or key in ``data``
    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 : vector or key in ``data``
    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 : vector or key in ``data``
    Grouping variable that will produce lines with different dashes
    and/or markers. Can have a numeric dtype but will always be treated
    as categorical.
{params.core.data}
{params.core.palette}
{params.core.hue_order}
{params.core.hue_norm}
{params.rel.sizes}
{params.rel.size_order}
{params.rel.size_norm}
{params.rel.dashes}
{params.rel.markers}
{params.rel.style_order}
{params.rel.units}
{params.rel.estimator}
{params.rel.ci}
{params.rel.n_boot}
{params.rel.seed}
sort : boolean
    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"
    Whether to draw the confidence intervals with translucent error bands
    or discrete error bars.
err_kws : dict of keyword arguments
    Additional paramters to control the aesthetics of the error bars. The
    kwargs are passed either to :meth:`matplotlib.axes.Axes.fill_between`
    or :meth:`matplotlib.axes.Axes.errorbar`, depending on ``err_style``.
{params.rel.legend}
{params.core.ax}
kwargs : key, value mappings
    Other keyword arguments are passed down to
    :meth:`matplotlib.axes.Axes.plot`.

Returns
-------
{returns.ax}

See Also
--------
{seealso.scatterplot}
{seealso.pointplot}

Examples
--------

.. include:: ../docstrings/lineplot.rst

returnsseealso)Z	narrativer    r   r   )r$   r%   r&   r'   r5   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ra   c             K   s   t jt }t |||||||||||d}|j|||d |j|	|
|d |j||d |d krhtj }|jsr|S |j	| |j
|| |S )N)r   r0   r   r   r   r   r   r   r   r   r   )r   r   rP   )r   r   rP   )r   r   )r   r   r   r   r   r   r   r   r   r   rH   )r$   r%   r&   r'   r5   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ra   r   r0   r   r+   r+   r.   r     s     
a  Draw a scatter plot with possibility of several semantic groupings.

{narrative.main_api}

{narrative.relational_semantic}

Parameters
----------
{params.core.xy}
hue : vector or key in ``data``
    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 : vector or key in ``data``
    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 : vector or key in ``data``
    Grouping variable that will produce points with different markers.
    Can have a numeric dtype but will always be treated as categorical.
{params.core.data}
{params.core.palette}
{params.core.hue_order}
{params.core.hue_norm}
{params.rel.sizes}
{params.rel.size_order}
{params.rel.size_norm}
{params.rel.markers}
{params.rel.style_order}
{{x,y}}_bins : lists or arrays or functions
    *Currently non-functional.*
{params.rel.units}
    *Currently non-functional.*
{params.rel.estimator}
    *Currently non-functional.*
{params.rel.ci}
    *Currently non-functional.*
{params.rel.n_boot}
    *Currently non-functional.*
alpha : float
    Proportional opacity of the points.
{{x,y}}_jitter : booleans or floats
    *Currently non-functional.*
{params.rel.legend}
{params.core.ax}
kwargs : key, value mappings
    Other keyword arguments are passed down to
    :meth:`matplotlib.axes.Axes.scatter`.

Returns
-------
{returns.ax}

See Also
--------
{seealso.lineplot}
{seealso.stripplot}
{seealso.swarmplot}

Examples
--------

.. include:: ../docstrings/scatterplot.rst

r      )r$   r%   r&   r5   r'   r   rowcolcol_wrap	row_order	col_orderr   r   r   r   r   r   r   r   r   r   kindheightaspect	facet_kwsr   c       +         sp  |dkr"t }t}|d krdn|}n4|dkrDt}t}|d kr>dn|}ndj|}t|d|krdj|d }tj|t |j	d |||j
t |d  j|||d	  j|||d
  j|||d d jkr jj} jj} jj}nd  } }}d jkr jj} jj} jj}d jkrn jj}|rJ fdd|D }nd }|rh fdd|D }nd }nd  } }} j} j}  j}!t|||||||||dd
}"|"j| |dkr|"j	d d'}#|!|#  _ j|t| |||||||dd dd |D }$|"j|$  fdd|#D }%|$j }&|&j|%  jj|&d}'|d krNi n|j }tf d|'jdddi|%||	|
||dd |}(|(j|f|" |(j |j!d!d |j!d"d  |r|  _ j"|(j#j$d#   j%r|(j& j% j' j(dd$ d%d |j) D })|(j*j|)d}*|d k	rf| d k	s*|d k	rft+|t,j-sBt,j-|}t,j.||*|*j/j0|j/ ddd&|(_*n|*|(_*|(S )(Nr   Tr   zPlot kind {} not recognizedra   zarelplot is a figure-level function and does not accept the `ax` parameter. You may wish to try {}rH   )r   r0   r   )r   r   rP   )r   r   rP   )r   r   r   r&   r5   r'   c                s   i | ]} j |d |qS )r<   )rY   )r,   k)r   r+   r.   
<dictcomp>  s    zrelplot.<locals>.<dictcomp>c                s   i | ]} j |d |qS )r   )rY   )r,   r   )r   r+   r.   r     s    F)
r   r   r   r   r   r   r   r   r   r   r   r   r   )r$   r%   r&   r5   r'   r   r   r   )r   r0   c             S   s   i | ]}d | |qS )ri   r+   )r,   r2   r+   r+   r.   r     s    c                s   i | ]} j j|d |qS )N)r0   r1   )r,   r2   )r   r+   r.   r     s    )r   r   r   all)Zaxishow)r   r   r   r   r   r   r$   r%   r   )r_   Zlabel_orderr-   Zadjust_subtitlesc             S   s0   i | ](\}}|d kr d| dn|d| qS )Nri   r+   )r,   r   r2   r+   r+   r.   r   !  s   )Z
left_indexZright_index)r   r   )1r   r   rp   r   r   rK   warningswarnUserWarningrM   r   r   r   r   r   r0   rN   Zlookup_tablerO   rP   rX   rY   rU   Z	semanticsr?   r=   Zassign_variablesr   renamer	   r   Zmap_dataframeZset_axis_labelsr1   rk   ZaxesZflatr_   Z
add_legendr`   r^   itemsr   rI   r   r   merger   
difference)+r$   r%   r&   r5   r'   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Zplotterrh   rc   msgr0   rU   Zplot_semanticsZplot_kwsZgrid_semanticsZplot_variablesZgrid_kwsZnew_colsZ	full_datagZ	orig_colsZ	grid_datar+   )r   r.   r     s    













a	  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.

{narrative.main_api}

{narrative.relational_semantic}

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
----------
{params.core.xy}
hue : vector or key in ``data``
    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 : vector or key in ``data``
    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 : vector or key in ``data``
    Grouping variable that will produce elements with different styles.
    Can have a numeric dtype but will always be treated as categorical.
{params.core.data}
{params.facets.rowcol}
{params.facets.col_wrap}
row_order, col_order : lists of strings
    Order to organize the rows and/or columns of the grid in, otherwise the
    orders are inferred from the data objects.
{params.core.palette}
{params.core.hue_order}
{params.core.hue_norm}
{params.rel.sizes}
{params.rel.size_order}
{params.rel.size_norm}
{params.rel.style_order}
{params.rel.dashes}
{params.rel.markers}
{params.rel.legend}
kind : string
    Kind of plot to draw, corresponding to a seaborn relational plot.
    Options are {{``scatter`` and ``line``}}.
{params.facets.height}
{params.facets.aspect}
facet_kws : dict
    Dictionary of other keyword arguments to pass to :class:`FacetGrid`.
{params.rel.units}
kwargs : key, value pairings
    Other keyword arguments are passed through to the underlying plotting
    function.

Returns
-------
{returns.facetgrid}

Examples
--------

.. include:: ../docstrings/relplot.rst

)*r   Znumpyru   Zpandasr   Z
matplotlibrQ   Zmatplotlib.pyplotZpyplotr   Z_corer   utilsr   r   r   r   r   Z
algorithmsr   Zaxisgridr	   r
   Z_decoratorsr   Z_docstringsr   r   __all__r?   Z_relational_narrativeZ_relational_docsZfrom_nested_componentsZ_param_docsr#   rp   r   r   r   __doc__r   r   r+   r+   r+   r.   <module>   s   



	 # [o
a] l