L i#ddlmZddlmZddlZddlmZddlmZddl Z ddl Z ddl ZddlmZddlmZddlmZdd lmZddlmZdd lmZmZdd lmZmZm Z dd l!m"Z"dd l#m$Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1m2Z2m3Z3ddl4m5Z5ddl6m7Z7m8Z8gdZ9GddeZ:Gdde:Z;eed?d@edAdBedCdDedEdFedGdHedIdJedKdLedMdNedOdPedQdRedSdTedUdVedWdXedYdZed[d\ed]d^ed_Z=e=j}e8 dddddddddd`dadbdcddddbddddedddbddfdgZ?edhjdie=e?_A dddddddddd`dadidedcdbdddbdjdkdldmdndeddddedbeeedddo!dpZBedqjdie=eB_A dddddddddd`dadbdcddddrdsdtdudadddeddbedddddvdwZCedxjdie=eC_A dddddddadeddddyeddddeddbddzd{ZDed|jdie=eD_A dddddddeddddydddddeddbdudd}d~ZEedjdie=eE_A dddddddddddddddd`daddcdbdddeddbddeeedddZFedjdie=eF_A dddddddddddddddeededdeddddbdeeeedddZGedjdie=eG_A dddddddddd`dadddcdbdddeddbdddZHedjdie=eH_A dddddddddddddddddddydmddeddddddbdadadadeded!dZIedjdie=eI_AGddZJeddZKGddZLy)) namedtuple)dedentN) rgb_to_hls)partial)normalize_kwargs)PatchCollection) MarkerStyle) Rectangle)default deprecated) VectorPlotter infer_orientcategorical_order)KDE)utils) desaturate_check_argument _draw_figure_default_color_get_patch_legend_artist_get_transform_functions_scatter_legend_artist_version_predates)groupby_apply_include_groups)EstimateAggregator LetterValuesWeightedAggregator) light_palette) FacetGrid _facet_docs) catplot stripplot swarmplotboxplot violinplot boxenplot pointplotbarplot countplotceZdZddddZddiZdgZdidddddffd Zd"d Zd Zd Z d Z dZ dZ dZ dZdZdZdZdZd#dZd$dZedZdZdZfdZdZdZdZdZd Zd!ZxZ S)%_CategoricalPlotterz@columns@valuesxyhuer/colorNFautoct||||jdk(r|dvr|jj ddd|_t |j }|j jdd} |j jdd} |jjdd} |jjdd} d|vr| |j d<| |jd<d|vr| |j d<| |jd<|jdk(rHd|j vr:|8|jjdd |j jdt|jjdd|jjdd|d |_ ||_ |jsy|j|j vrKd|j |j<d |j|j<d|j|j<t|j|j|} | |j |j<y)N)data variableswide)hr/r/r.r.r/columnsr0axisF)r.r/orientrequire_numeric categorical)super__init__ input_format plot_datarenamesetr5pop var_typesdroprgetr>legend has_xy_datar var_levels)selfr4r5orderr>r?r1rLorig_variablesorig_xorig_y orig_x_type orig_y_type cat_levels __class__s Y/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/seaborn/categorical.pyrCz_CategoricalPlotter.__init__8s  di8    &6Z+?!^^223;O2PDN 0N^^''T2F^^''T2F..,,S$7K..,,S$7Kn$&,s#&1s#n$&,s#&1s#    ''! NN  A  . NN  u %#nn  d+nn  d+!      ;;dnn ,*.DNN4;; '*7DNN4;; '*,DNN4;; ''t~~dkk'BEJ '1 $c,|duxs|du}|rd|jvr|rd|_|j|j|jd<|j|j|jd<d|jd<|j |j}t |tr||jDcic]\}}t||}}}nOd|jvr8|jd|j|jk(j}nd}||_d|jvrZ|X|Vt |tstjj|}d|}d|d} tj| t d ||fScc}}w) aImplement backwards compatibility for hue parametrization. Note: the force_hue parameter is used so that functions can be shown to pass existing tests during refactoring and then tested for new behavior. It can be removed after completion of the work. Nr0Tr@Fzdark:zf Setting a gradient palette using color= is deprecated and will be removed in v0.14.0. Set `palette='z'` for the same effect.  stacklevel)r5_redundant_huerEr>rIrN isinstancedictitemsstrallmplcolorsto_hexwarningswarn FutureWarning) rOr1palette hue_order force_huedefault_behaviorkv redundantmsgs rX_hue_backcompatz#_CategoricalPlotter._hue_backcompatsw$!D=?G4,? dnn49I"&D $(NN4;;$?DNN5 !$(NN4;;$?DNN5 !$1DNN5 ! 4I'4(18AA3q619AA&!^^E2dnnT[[6QQVVX ! "+D  DNN "w5;LeS) ))%0eWoG55rgrhrirLrErKrIrN _var_levelsrH)rOrjrkrqs rX_palette_without_hue_backcompatz3_CategoricalPlotter._palette_without_hue_backcompats  &7+>??C{{mLII  MM#} ;DK$(NN4;;$?DNN5 !$(NN$6$6t{{$CDNN5 !$(NN$6$6t{{$CDNN5 !++DKK8I     -rYc4|turPtjddz|z}|dz}|dz}d}tj|d|j ||||tur8d }|s|d z }|j d |d z }tj|dyy)zGProvide two cycles where scale= and join= work, but redirect to kwargs.lines.linewidth??z The `scale` parameter is deprecated and will be removed in v0.15.0. You can now control the size of each plot element using matplotlib `Line2D` parameters (e.g., `linewidth`, `markersize`, etc.). r[r\) linewidthmarkeredgewidth markersizezD The `join` parameter is deprecated and will be removed in v0.15.0.z@ You can remove the line between points with `linestyle='none'`.rA) linestyle N)r rdrcParamsrgrhupdate)rOscalejoinkwargslwmewmsrqs rX_point_kwargs_backcompatz,_CategoricalPlotter._point_kwargs_backcompats  "/036>Bs(CaB  MM#! , MMBM K z !U V  + 4KC MM#! , "rYcfd}| |dd||dd|| d}d}tj|td |fS) zFProvide two cycles where existing signature-level err_kws are handled.c~|turyd|d|d}d|d|d}tj|td||<y) Nz err_kws={'z': }z The `zA` parameter is deprecated. And will be removed in v0.15.0. Pass `z ` instead. r\r rgrhri)namekeyvalsuggestrqerr_kwss rXdeprecate_err_paramzD_CategoricalPlotter._err_kws_backcompat..deprecate_err_paramsZj #C5C7"5GD6"%%,I\;  MM#} ;GCLrYerrcolorr1errwidthr{rzi Passing `capsize=None` is deprecated and will be removed in v0.15.0. Pass `capsize=0` to disable caps. r[r\)rgrhri)rOrrrcapsizerrqs ` rX_err_kws_backcompatz'_CategoricalPlotter._err_kws_backcompatsZ     GX >J X> ?GB  MM#} ;rYc|tur$|}d|d}tj|td|tur%|}d| d}tj|td||fS)1Provide two cycles of backcompat for scale kwargsz\ The `scale` parameter has been renamed and will be removed in v0.15.0. Pass `density_norm=z` for the same effect.r[r\z` The `scale_hue` parameter has been replaced and will be removed in v0.15.0. Pass `common_norm=r)rOr scale_hue density_norm common_normrqs rX_violin_scale_backcompatz,_CategoricalPlotter._violin_scale_backcompats}  " L227:PR  MM#} ; J &#K15>?UW  MM#} ;[((rYcp|tur-|}td|d}tj|td|S)zGProvide two cycles of backcompat for violin bandwidth parameterization.z{ The `bw` parameter is deprecated in favor of `bw_method`/`bw_adjust`. Setting `bw_method=z`, but please see docs for the new parameters and update your code. This will become an error in seaborn v0.15.0. r[r\)r rrgrhri)rObw bw_methodrqs rX_violin_bw_backcompatz)_CategoricalPlotter._violin_bw_backcompatsE Z I$$&6* C MM#} ;rYc||tur3|}d|}|dk(r|dz }n|dz }tj|td|S)rzl The `scale` parameter has been renamed to `width_method` and will be removed in v0.15. Pass `width_method=areaz<, but note that the result for 'area' will appear different.z for the same effect.r[r\r)rOr width_methodrqs rX_boxen_scale_backcompatz+_CategoricalPlotter._boxen_scale_backcompat(sZ  " L@@EyJ UU.. MM#} ;rYc|dk(r!d}tj|tdd}n ||turd}|dk7r|S|j$|yt j j|g}nD|jjDcgc]!}t j j|#}}tj|d}|Dcgc]}t|ddd } }t| d z} | | | fScc}wcc}w) zBAllow a color to be set automatically using a basis of comparison.grayzkUse "auto" to set automatic grayscale colors. From v0.14.0, "gray" will default to matplotlib's definition.r[r\r2Nrr<r;g333333?) rgrhrir lookup_tablerdreto_rgbvaluesnpuniquermin) rOr1 base_colorhue_maprqbasisc unique_colorsrgb light_valslums rX_complement_colorz%_CategoricalPlotter._complement_color8s F?C  MM#} ;E ]ew.E F?L    '!ZZ&&z23E3:3G3G3N3N3PQaSZZ&&q)QEQ %a0 9FG#j#bq'*1-G G*o"S# RGs &C3 C8c&|tur|j||}d|jvrY|jj}t |t r!t||Dcic]\}}|| }}}|S|Dcic]}||}}|Sd|i}|Scc}}wcc}w)zFSupport pointplot behavior of modifying the marker/linestyle with hue.r0N)r rHr5_hue_maplevelsr_listzip) rOrvaluefallbackplot_kwsrrnromappings rX_map_prop_with_huez&_CategoricalPlotter._map_prop_with_hueRs G LLx0E DNN "]]))F%&,/,>?DAq1a4??  .441e844UmG @4s  B4 Bc n|j|dk7ry|j|jrytt |d|d}|dk(r3|j j d|jd|dz d y|jj d|j|dz dd y) z0Set ticks and limits for a categorical variable.r@Nget_ticksr.Fg?)r2) rIrEemptylengetattrxaxisgridset_xlimyaxisset_ylim)rOaxr=ns rX_adjust_cat_axisz$_CategoricalPlotter._adjust_cat_axisbs >>$ = 0  >>$  % %  /d4&./1 2 3; HHMM% KKQV$K / HHMM% KKB$K /rYc*t|jddht|jz}d|jvrW|j|j }|jg|dj }|j |j k7Sy)z3Return True when use of `hue` would cause overlaps.colrowr0F)rr>rGr5rE value_countssize)rOgroupersr>paireds rX _dodge_neededz!_CategoricalPlotter._dodge_neededseU3c$..6IIJ DNN "^^H-::)rOkeysr4hue_idxr full_widthoffsets rX_dodgez_CategoricalPlotter._dodges  & --&&,,T%[9  $$ % W  ']Q& g(4=1+<|ddz }||||z |d<||||z|djz |d<dD]}||x} |vs||| || <y)z=Undo scaling after computation so data are plotted correctly.rrrzedge)rArmaxN)rr>to_numpy) rOrr4varsvar_invhwsufrs rX _invert_scalez!_CategoricalPlotter._invert_scales /C-b#a&9FAsdkk!go']Q&"49r>2V #DIN 3d6l6K6K6M MW ) /!U3%=(CT1 #DIDI /  /rYc|jdk(r|j xr|jdk7}nt|j}|rH|j |||||j \}}|r|j|j yyy)Nr2r6) semantic_kws)title)rLr^rDbooladd_legend_dataget_legend_handles_labels legend_title)rOrfunc common_kwsr show_legendhandlesrs rX_configure_legendz%_CategoricalPlotter._configure_legends ;;& "111Qd6G6G66QKt{{+K   T:L Q557JGQ  1 1 2 rYc |j|jdk(rytj|j|j}t |dkDr*tj tj|}|Sd}|S)zCReturn unit of width separating categories on native numeric scale.r@r;)rIr>rr comp_datarnanmindiff)rO unique_values native_widths rX _native_widthz!_CategoricalPlotter._native_widthsr >>$++ &- 7 $.."=> }  !99RWW]%;)((8,rYcd|jz}|j||}|durd}n t|}d|jvr:|r8|jj "|t |jj z}||jz}ttjj| |}|jg} |r| jd|j} dx} } d|vr.t|djs|j!dd|j#| dd D]\} }|j%| } |H|dk7j'r5||dj)|jj j*} t |d kDr|t | nd} ||j| z| z}|||j<|j-| || j.|d |d fd|i|}d|jvs|j1|j |d |j3| t4|y)N皙?Tg?r0)lowhighrmarker edgecolorfrom_comp_data allow_emptyr;)rr.r/r1)r)rrfloatr5rrrrrrandomuniformr>appendrr is_filledrH iter_data _get_axesanymaprrscatterset_facecolorsrr)rOjitterrr1rrrjlimjitterer iter_varsr dodge_move jitter_movesub_varssub_data adjusted_datapointss rX plot_stripsz_CategoricalPlotter.plot_stripss'T'''&&ue4 T>D=D DNN "u1E1E1Q C ,,- -D """299,,4%teD[[M    U # WW#$$ [ x  HX4F(G(Q(Q(S LLd +"&..@D=A#1#C F Hh)B"1 '9'9';$Xe_%8%89M9M9S9S%TU :=h-!:K(H 6QRK$T[[1J>LM$1HT[[ !   r8 ,RZZ x}VEVXVF&%%dmmHUO&DE# F& r#9hOrYcdjz}j||}jg}|r|jdji}d} d|vr.t |dj s|jddj|ddD]\} } j| |5|| djjjj} | js| j| z| j<j| j | d| d fd |i|} dj"vr#| j%j| d| jr| || jj&df< t)|j| |j+D]J\\} } | j-j.dd kDs*| d fd }|j1| | _Lt5j6j9t:|y)Nrr0rr r Tr r.r/r1)rr> warn_threshr;)centercp|| jdk(rd}j}nj}d} j jdk(}j |j j |s|s|rj||t|j|+|y)Nr/Fr@scalexscaley) r>get_autoscaley_onget_autoscalex_onrIupdate_datalim get_datalim transDataautoscale_viewrBrWdraw) r$rendererr(r+r, fixed_scalerWrbeeswarmrOs rXr3z-_CategoricalPlotter.plot_swarms..draw4sVV,{{c)!&!#!5!5!7!#!5!5!7!& #'.."="NK%%f&8&8&FG&Ff)))G&**F8BrY)rrr>rrr rrHrrrrrrrrrr5rilocBeeswarmra get_offsetsshape__get__r3rfigurerr)rOrr1r'rrrrpoint_collectionsrr!r"r$r(r3rr6rWs` @@rX plot_swarmsz_CategoricalPlotter.plot_swarmss*T'''&&ue4[[M    U # WW x  HX4F(G(Q(Q(S LLd +"&..@D=A#1#C P Hh)B"$Xe_%8%89M9M9S9S%TU >>(0(= (J%   r8 ,RZZ x}VEVXVF&%%dmmHUO&DE>>IO!2x '<'A'A!'D"EF' P*% U$5$;$;$= 3 LR&!!#))!,q05;CC,#ll62 3 36 RYY r#98DrYc x dg} ddd|j} tjjf fd } |s|tjd} j dtjd} j d j d d |rtjjntjj}| d || d | d| d| dd}|d j dd|dj dd|dj d| |j}|j| dd D]\}}|j|}|j|j| }t||jjjt }|Dcgc]\}}|j#}}}t%j&tj(j+|||}||j,z}t%j&|j|d|i}|r|j/|||r|dxxd|z zcc< j1dd|dz}|j3||t5|| \}}dD]}|||||<|dj7||d<t9|d|jdd k(}d|vr|j;|dn|} |r/| |d!|d }!d"|i|d }"d"|i|d}#d#|i|d}$d"|i|d}%n-d"| i|d }!d"| i|d }"d"| i|d}#d#| i|d}$d"| i|d}%||!|"|#|%fD]}&|&j d$|t=d0|j?d%||j|r|dnd&||jdk(d |!|"|#|$|%d' tAtd(rind|i}'i|' }(|jBd0i|(})ddgjE|j}*|stG|j?d%D]\}+},|,d)}-|,d)|,dz}.|)d*r|)d*|+}|r%|jIjJjL}/n|jO}/|-|/|*d&<|-|/|*d+d|.|/|*dd+|s|jQ|/|jStUjV|/|jdk(|jdk(,|)d-rA|)d-|+jYjL}0|-|.f|0|*dd|)d-|+jQ|0|)d.st5||j\}1}2|)d.d/|+zd/|+zd/zD]}3|2|1|,|j||+d/z z }-|2|1|,|j||+d/z z}.|3jYjL}0|-|.f|0|*dd|3jQ|0|j[t]|)t_|}4|ja||4!ycc}}w)1Nr0r/r.r8cBtj|di|S)Nprops)rrH)elementartistrs rX get_propsz1_CategoricalPlotter.plot_boxes..get_props`s"#HLLG9E1BB$GP PrYrw bootstrapzboxplot.bootstrap shownotchesnotchFboxmedianwhiskerfliercap)rHrIrJrKrLsolid_capstylebuttr}Tr )whisrErr; capwidthsr)rmedq1q3cilocihiwhislowhishifliersrrlinear facecolorr r1markeredgecolorr{recordsr) bxpstats positionswidths patch_artistvert manage_ticksboxprops medianprops whiskerprops flierpropscappropsz3.6.0rboxesr[updatexupdateymedianscapsrz)1r>rdlinesLine2DrrH setdefaultpatchesr rrrgroupbysortedrastyperrpd DataFramecbook boxplot_statsrrrKrrrrrr`to_dictrbxpr enumerateget_pathverticesTget_dataset_datar/r transpose get_xydata add_containerBoxPlotContainerrr)5rOrrgapfillrOr1 linecolorr{ fliersizerr value_varrDrE box_artistrArr!r"groupedr_rr. value_datastats orig_widthr4capwidthrstatlinear_orient_scale maincolorrdrerfrgrh prop_dict default_kws boxplot_kwsartistsori_idxirHp0p1 box_vertsvertsf_fwdf_invline legend_artists5 ` rX plot_boxesz_CategoricalPlotter.plot_boxesOsG C(5 &)ii&6&6 Q ) %67ILLcll;N.OP M8<<+GH.2S[[** 8H8H UJ/) +w'U#   h""#3V< i##$4f= g!!, : WW"&..@D=B#1#Do 8 Hh)B&&t{{3I>Gx 4;;=DDUKLI3:;41a!**,;J;LL!8!8$CL"9"NOE!3!33J<<i* MND Hd+W S( ||KtG}1DEH   r4 (-b)rrcopyrdrrrrrrwrxrrrvrrritemrrrrangerr add_collectionrr/ column_stackplotfullrrr2rr)qA"1+wqz2B'NJqMqA Yr1a01 2,5YO ,2)L N NKNgNN   oeF~FPU  V   8 45 s* s*  (#C'"'')A-B{{c! Vb[9:GS#JtjP|3|=|3|>g}?tjP|4|:|4|:g}@tjP|?|@gjSd)dd$}Ajdk(rAddddddd1f}A||d)z d/| }tjP|3|=|3|>g}?tjP|4|C|4|Cg}@tjP|?|@gjSd)d$d}Ajdk(rAddddd1ddf}Agd8}Dt]AD]"\}E}F||D|Ed9| }<|jD|Fi|<$7| j dsJtj^ja|:d$}CtjJ|;j}5|r|5|.rd1nd|;d'zd)z z }5|5|5g|5|5g|5gf}5Cd:|Cd;g|Cd<|Cd=g|Cd>gf}6jdk(r|5|6c\}G}H}I\}J}K}Ln |6|5c\}G}H}I\}J}K}L|rm|.rdnd1zd?z d)z }Mjdk(rMd$fnd$M f\}N}O|jbtjdjg|N|O|jhjjz}Pn |jb}P|Pd@| dAi}Q|jD|1G|2Jfi|Q|QdA<|jD|1H|2Kfi|Q|dBz |dCz |PdD| dEdE|dF}R|jD|1I|2Lfi|Rtm|}Si|||dG}Tjo||S|Tycc}wcc} wcc} wcc}#wcc}#wcc} wcc} }#w#1swYxYwcc} wcc} }#w)INr0r/r.r8)rHquartstickpointNinnerT)prefixr)rcountrrzpatch.linewidthrwrH box_widthg@ whis_widthr[r r|Fr weightsr;weightr)r[r r{density)position observationsrsupportrr!rcHtfd|jDS)Nc3LK|]\}}|jk7s||fywN)r>).0rnrorOs rX zH_CategoricalPlotter.plot_violins..vars_to_key..s$QDAqT[[@P!QQs$ $)tuplera)r!rOs rX vars_to_keyz5_CategoricalPlotter.plot_violins..vars_to_keysQHNN,<QQ QrYr!rignorez All-NaN (slice|axis) encounteredrrrr)rrzrrrrr )r1r{rrzorder)r1r rrrrr)r2K)rry)g@r;r)r1r{dashesrVrWrRrSrQH)r1 transformr{g333333?)r r}r|rr)r\markerfacecolorr1rro)8r>rrdr startswithrHrrrrK _transformrr`rrrnanmaxrrrgcatch_warningsfilterwarningsrrw RangeIndexrxrisnanr5rrrr7rr fill_betweenx fill_betweenarrayrinterpstackr collectionsLineCollectionr percentiler}ryrzr1 transformsScaledTranslationr<dpi_scale_transrr)UrOrrrsplitr1rrr{rrrkde_kws inner_kwsrrr inner_optionsrrr kder violin_datar!r" stat_datarrrviolin norm_keysrocommon_max_densitycommon_max_countr max_density max_count real_widthrr4norm_keyr peak_densityspanr right_siderrinvxinvyinv_posrrrr.r/ plot_funcobspos_dictkwspos0pos1pos_ptsval_ptssegmentsrprrrsegmentx0x1x2y0y1y2rdxdytransrdot_kwsrrsU` rX plot_violinsz _CategoricalPlotter.plot_violinsxs $[[%( C(5 @ dC(BLQ   3<<0A#BB LL):;  !1!1%!8! k9s?CI"|Y]CJ]]8DKK34FSCPFnGn WW #'..@D=B#1#D  Hh"*i!;HX xB?I:?8:K huo6QVI% " ###K   $T[[1 ( 3$Y/$Y/5[5H5$nnX.  # 8 RDOO[ !34O O !# +T1AiL,<,<,>+T!U !yy+)VQ#a.?*@)VW >GHs3 22HKH:CD3..DID((* ''2TU #, 4?$/0&q}5<) ((*$  ( RYY4? /0"1Z=1S8.)* IT/// "l 7FMM!SVI->)?%CDE<< VJ/6),6), !  D F:.5W S( #6*#56Hg"B!),002Lxx %'IX)>>(F>23I58AT9TU(I5"9U2D$..0]]))//z0B50IJQN -72tby/dRi_*B.r37GAt.r37GAt t,T[[9G t,Y7Gx(5Ixx %4;;',,Q/^,113;;#%'!*,cGAJ.>?#sqA:gaj(8# :J'KqAQa YO!..R__EdkkRI Y(T[[)GAJ67T[[)GAJ67 "  (C VJ%7*MH F:.9!a#g.!}!!'*hh 56SAB*B!x7HH1LLC%)[[C%7Szc3Z1&!*#a-A-$X.228Q?!C    47DG3s3!!'*yyd9otDKK7H7ST:7UVyyd9otDKK7H7ST:7UV((GDM74=#AB((GCL'#,#?@88Wg$67AA!QJ;;#%'1dd 3H&!*Q  66xG3G!!%!7!!'* c<8yyYdkk9JWUVZ9WXyyYdkk9JWUVZ9WX((GDM74=#AB((GENGEN#CD88Wg$67AA!QJ;;#%'4R4 3H="+H"5-JAw!*%."()$ C BGGW,,-!!%( //4Q7hhx 45*B!x7HH1LLCCj3*se38_eHo64[%+.5\N ;;#%14c.LRR,2r214c.LRR,2r2#-a2BRG!KF,0KK3,>fa[QLFBLL3>>+K+KB 9 9,ELLE&!&    R$r(7h7(1%R$r(7h7$"+c/'01}!&    (+'*& R$r(6g6Yl 7\16 QQyyQ  r=*=UP+T)VHD $   sf(l?mm % m5 mm#2m (m3 m<m# m5%#m0 m5mm##m-0m5c ddd|j} dg} t|tjj}|j dtj ddz|j d|dd z|j d |dtjd tjzz|jd |d |}|jd|d|}|j|j} |j|jdk(r|t|j|jj} t|j|jj!} t#| | dzDcgc]}|} }|j$j&dnt)|j$j&}|durd|z}|j*}|j-| ddD].\}}|j/|}t1||jd}t3||j\}}||j5| }|j6r|nq|j9|jj:|| fit=dj?tAjB||jjE}|r`|j$j&jG|d}||dz z }| d z ||zz}||jxx||jHzz cc<|jK|||jM}|jO||jQd||jQdd|vr|j%|dn||jR|d|dfi|\}|jM}|jU}dD]}|j ||||jV|jY||||1t[tjjgg} d||di}!|j]|| |!ycc}w)Nr/r.r8r0r{rwrxr|ryr}rzr or~-r@r;rTg?r r=F)r)r r~r1)r1r{alphar)r r~)/r>rrdrprqrrrrsqrtpirrNrIintrrrrrrrrrrrr convert_unitsrrtapplyrreindexrwIndex reset_indexrrrrrrKr properties error_methodplot_errorbarsrr)"rO aggregatormarkers linestylesrr1rrragg_varrbase_positions min_cat_val max_cat_valr n_hue_levelsrr!r"ori_axisrrr_agg_datar step_sizersub_kwsr sub_err_kws line_propsproprrs" rX plot_pointsz_CategoricalPlotter.plot_pointss#&t{{3G #Hcii.>.>?K6G)H3)NO-x /Dt/KLL(;*?"''!bee)BT*TU))(GS(K,,[*c8T 5 >>$++ &- 7dnnT[[9==?@KdnnT[[9==?@K).{K!O)LMAaMNM MM008qc$--BVBV>W D=<'E WW"&..@D=A#1#C' H Hh)Brdkk]$#78H3B DLIq!("8"8"HII#+>>x%z7S.J5.QS)$++>? --..44Xe_E!\A%56 !i'&99%$2D2D)DD%   r8 ,mmoG NNx||E23$X\\%%898=8IdmmHUO4u   BGGHSM8C=DGDED!,,.K*JA ?&&tZ-=> ?&&2##B';GO' HR  0 0"b9 ' KL  r='<HgNs Q c ddd|j} dg} |j} |jjd}|r$|"|t |jjz }|s&| j ddt jdz|j ddt jdz|j| d d D]\} }|j| } |jr|nC|j|jj|| fitdj}||jz|d <|r|j!| ||r|d xxd |z zcc<||j|d d z z |d<|j#| ||jdk(r$| j$}t'|d|d|d }n#| j(}t'|d|d|d }d| vr|j| dn|}d|d<|r|j+||n|j+||d|dii|| |j,|j/| ||d|rdn|i|t1|}|j3| || y)Nr/r.r8r0Fr{?rwTr rr;rzr)r.heightr)r/rrUalign)r1r[r)r1r r[r1z.26ro)r>rrrrrrrdrrrrrtr<rr?rrrbarr`barhrrArBrr)rOrCrrrrr1rrrrFrrr!r"rLbar_funcr" main_colorrs rX plot_barsz_CategoricalPlotter.plot_barss#&t{{3G WW ==   'E W(DMM$8$8 99G    S3<<@Q3R-R S;cll;L.M(MN"&..@D=A#1#C0  Hh)B#+>>x%z7S.J5.QS !&(:(: :HW  Hh/!QW,!' 4x7H17LLHV    r8 ,{{c!66v&x}HWDU77v&hsmHWDUr{r`rrrr concatenatenanr)rOrr4rrrrrrcwsclrrLargss rXrBz"_CategoricalPlotter.plot_errorbars.sc"4;;/<< * &Cs)C((C ,c$++.>?@C((C3%s ,cSE+.>?@Ct111A53B DS#c!f+*+SSVr1A-BBnn"cN266NC"&&3&nnVSVRVV,cBFFCGSW3M&{{c!CxCx BGGT %W %/ &rY)F)r8)NN)!__name__ __module__ __qualname__wide_structureflat_structure_legend_attributesrCrrrurrrrrrrrrrrrpropertyrrr%r>rrr3rRr[rB __classcell__)rWs@rXr+r+1s%IjIN9%N!L2\3"j(-< 6)(  4 0> $ / 3   &1PfHETZZR>hNI`P` for more information. .. note:: By default, this function treats one of the variables as categorical and draws data at ordinal positions (0, 1, ... n) on the relevant axis. As of version 0.13.0, this can be disabled by setting `native_scale=True`. input_paramsz x, y, hue : names of variables in `data` or vector data Inputs for plotting long-form data. See examples for interpretation. categorical_dataz data : DataFrame, Series, dict, array, or list of arrays Dataset for plotting. If `x` and `y` are absent, this is interpreted as wide-form. Otherwise it is expected to be long-form. order_varsz order, hue_order : lists of strings Order to plot the categorical levels in; otherwise the levels are inferred from the data objects. stat_api_paramsa estimator : string or callable that maps vector -> scalar Statistical function to estimate within each categorical bin. errorbar : string, (string, number) tuple, callable or None Name of errorbar method (either "ci", "pi", "se", or "sd"), or a tuple with a method name and a level parameter, or a function that maps from a vector to a (min, max) interval, or None to hide errorbar. See the :doc:`errorbar tutorial ` for more information. .. versionadded:: v0.12.0 n_boot : int Number of bootstrap samples used to compute confidence intervals. seed : int, `numpy.random.Generator`, or `numpy.random.RandomState` Seed or random number generator for reproducible bootstrapping. units : name of variable in `data` or vector data Identifier of sampling units; used by the errorbar function to perform a multilevel bootstrap and account for repeated measures weights : name of variable in `data` or vector data Data values or column used to compute weighted statistics. Note that the use of weights may limit other statistical options. .. versionadded:: v0.13.1 ciz ci : float Level of the confidence interval to show, in [0, 100]. .. deprecated:: v0.12.0 Use `errorbar=("ci", ...)`. r>a orient : "v" | "h" | "x" | "y" Orientation of the plot (vertical or horizontal). This is usually inferred based on the type of the input variables, but it can be used to resolve ambiguity when both `x` and `y` are numeric or when plotting wide-form data. .. versionchanged:: v0.13.0 Added 'x'/'y' as options, equivalent to 'v'/'h'. r1zS color : matplotlib color Single color for the elements in the plot. rjaC palette : palette name, list, dict, or :class:`matplotlib.colors.Colormap` Color palette that maps the hue variable. If the palette is a dictionary, keys should be names of levels and values should be matplotlib colors. The type/value will sometimes force a qualitative/quantitative mapping. hue_normz 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 `hue` is categorical. .. versionadded:: v0.12.0 saturationz saturation : float Proportion of the original saturation to draw fill colors in. Large patches often look better with desaturated colors, but set this to `1` if you want the colors to perfectly match the input values. rz[ capsize : float Width of the "caps" on error bars, relative to bar spacing. rz errcolor : matplotlib color Color used for the error bar lines. .. deprecated:: 0.13.0 Use `err_kws={'color': ...}`. rz errwidth : float Thickness of error bar lines (and caps), in points. .. deprecated:: 0.13.0 Use `err_kws={'linewidth': ...}`. rzw fill : bool If True, use a solid patch. Otherwise, draw as line art. .. versionadded:: v0.13.0 rz gap : float Shrink on the orient axis by this factor to add a gap between dodged elements. .. versionadded:: 0.13.0 rz width : float Width allotted to each element on the orient axis. When `native_scale=True`, it is relative to the minimum distance between two values in the native scale. rav dodge : "auto" or bool When hue mapping is used, whether elements should be narrowed and shifted along the orient axis to eliminate overlap. If `"auto"`, set to `True` when the orient variable is crossed with the categorical variable or `False` otherwise. .. versionchanged:: 0.13.0 Added `"auto"` mode as a new default. r{zR linewidth : float Width of the lines that frame the plot elements. rzy linecolor : color Color to use for line elements, when `fill` is True. .. versionadded:: v0.13.0 log_scalea log_scale : bool or number, or pair of bools or numbers Set axis scale(s) to log. A single value sets the data axis for any numeric axes in the plot. A pair of values sets each axis independently. Numeric values are interpreted as the desired base (default 10). When `None` or `False`, seaborn defers to the existing Axes scale. .. versionadded:: v0.13.0 native_scalez native_scale : bool When True, numeric or datetime values on the categorical axis will maintain their original scaling rather than being converted to fixed indices. .. versionadded:: v0.13.0 formatterz formatter : callable Function for converting categorical data into strings. Affects both grouping and tick labels. .. versionadded:: v0.13.0 rLa 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. .. versionadded:: v0.13.0 rz err_kws : dict Parameters of :class:`matplotlib.lines.Line2D`, for the error bar artists. .. versionadded:: v0.13.0 ax_inzh ax : matplotlib Axes Axes object to draw the plot onto, otherwise uses the current Axes. ax_outzY ax : matplotlib Axes Returns the Axes object with the plot drawn onto it. r$zH boxplot : A traditional box-and-whisker plot with a similar API. r%zL violinplot : A combination of boxplot and kernel density estimation. r"z stripplot : A scatterplot where one variable is categorical. Can be used in conjunction with other plots to show each observation. r#z swarmplot : A categorical scatterplot where the points do not overlap. Can be used with other plots to show each observation. r(zK barplot : Show point estimates and confidence intervals using bars. r)zL countplot : Show the counts of observations in each categorical bin. r'zM pointplot : Show point estimates and confidence intervals using dots. r!zG catplot : Combine a categorical plot with a :class:`FacetGrid`. r&z< boxenplot : An enhanced boxplot for larger datasets. ryTr2rrTF)r.r/r0rPrkr>r1rjrsrrrrrOrr{rrrrurtrvrLrc \t|t|||||||}|tj}|jj r|S| dk(r|j } |jj|jdk(s|s|j|j|||j|||j||}|j|||\}}| r| nd} |j|||| t|j |||j#Dcic] \}}|d vs ||c}}| }|j%|||j&}|j)| | | | |||||| |j+||j-||j |Scc}}w) Nr-r4r5rPr>r1rLr2r@rPrvrtr;rjrPnormrsrr1fcr[rs rrrrrOr1rr{rrr<)r+r`pltgcarErrrIrKr>scale_categorical_attachrurrmap_huerrrarrr_add_axis_labelsr)r4r.r/r0rPrkr>r1rjrsrrrrrOrr{rrrrurtrvrLrrprnros rXr$r$5s  aS)  A z WWY{{  !{{qxx M1 AHHEYGIIbII&11'9EI**5'9EGY#JIIgYX*IU  e ,,.S$!QA1R,RAS E ##IuajjAILL    rr) I+ Ts $ F(1F(a Draw a box plot to show distributions with respect to categories. A box plot (or box-and-whisker plot) shows the distribution of quantitative data in a way that facilitates comparisons between variables or across levels of a categorical variable. The box shows the quartiles of the dataset while the whiskers extend to show the rest of the distribution, except for points that are determined to be "outliers" using a method that is a function of the inter-quartile range. {categorical_narrative} Parameters ---------- {categorical_data} {input_params} {order_vars} {orient} {color} {palette} {saturation} {fill} {dodge} {width} {gap} whis : float or pair of floats Paramater that controls whisker length. If scalar, whiskers are drawn to the farthest datapoint within *whis * IQR* from the nearest hinge. If a tuple, it is interpreted as percentiles that whiskers represent. {linecolor} {linewidth} fliersize : float Size of the markers used to indicate outlier observations. {hue_norm} {log_scale} {native_scale} {formatter} {legend} {ax_in} kwargs : key, value mappings Other keyword arguments are passed through to :meth:`matplotlib.axes.Axes.boxplot`. Returns ------- {ax_out} See Also -------- {violinplot} {stripplot} {swarmplot} {catplot} Examples -------- .. include:: ../docstrings/boxplot.rst rHrzdscottr;r)!r.r/r0rPrkr>r1rjrsrrr rrrr{rcutgridsizer bw_adjustrrrrrvrtrurLrrrr rc! t|t|||||||}#|!tj}!|#jj r|!S|dk(r|#j }|#jj|#jdk(s|s|#j|#j|||#j|!||#j||}|#j|||\}}| r| nd} |#j|||| t|!j |||"j#D$%cic] \}$}%|$d vs |$|%c}%}$| }|#j%|||#j&}|#j)||||\}}|#j+||}t|||| }&| in| j-} |#j/| ||| || ||| |||&| |" |#j1|!|#j3|!|#j |!Scc}%}$w)Nr-rzr2r@r{r|r;r}rr)rrrrrrrr r1rrr{rrrr r rr<)r+r`rrrErrrIrKr>rrrurrrrrrarrrrrr3rr)'r4r.r/r0rPrkr>r1rjrsrrr rrrr{rrrrrrrrrrvrtrurLrrrr rrrrnror s' rXr%r%s  aS)  A z WWY{{  !{{qxx M1 AHHEYGIIbII&11'9EI**5'9EGY#JIIgYX*IU  e ,,.S$!QA1R,RAS E ##IuajjAI ! : : y, !L+''I6IsXiXG'Y^^-=INN  !"rr) IC Ts $ G81G8a, Draw a patch representing a KDE and add observations or box plot statistics. A violin plot plays a similar role as a box-and-whisker plot. It shows the distribution of data points after grouping by one (or more) variables. Unlike a box plot, each violin is drawn using a kernel density estimate of the underlying distribution. {categorical_narrative} Parameters ---------- {categorical_data} {input_params} {order_vars} {orient} {color} {palette} {saturation} {fill} inner : {{"box", "quart", "point", "stick", None}} Representation of the data in the violin interior. One of the following: - `"box"`: draw a miniature box-and-whisker plot - `"quart"`: show the quartiles of the data - `"point"` or `"stick"`: show each observation split : bool Show an un-mirrored distribution, alternating sides when using `hue`. .. versionchanged:: v0.13.0 Previously, this option required a `hue` variable with exactly two levels. {width} {dodge} {gap} {linewidth} {linecolor} cut : float Distance, in units of bandwidth, to extend the density past extreme datapoints. Set to 0 to limit the violin within the data range. gridsize : int Number of points in the discrete grid used to evaluate the KDE. bw_method : {{"scott", "silverman", float}} Either the name of a reference rule or the scale factor to use when computing the kernel bandwidth. The actual kernel size will be determined by multiplying the scale factor by the standard deviation of the data within each group. .. versionadded:: v0.13.0 bw_adjust: float Factor that scales the bandwidth to use more or less smoothing. .. versionadded:: v0.13.0 density_norm : {{"area", "count", "width"}} Method that normalizes each density to determine the violin's width. If `area`, each violin will have the same area. If `count`, the width will be proportional to the number of observations. If `width`, each violin will have the same width. .. versionadded:: v0.13.0 common_norm : bool When `True`, normalize the density across all violins. .. versionadded:: v0.13.0 {hue_norm} {formatter} {log_scale} {native_scale} {legend} scale : {{"area", "count", "width"}} .. deprecated:: v0.13.0 See `density_norm`. scale_hue : bool .. deprecated:: v0.13.0 See `common_norm`. bw : {{'scott', 'silverman', float}} .. deprecated:: v0.13.0 See `bw_method` and `bw_adjust`. inner_kws : dict of key, value mappings Keyword arguments for the "inner" plot, passed to one of: - :class:`matplotlib.collections.LineCollection` (with `inner="stick"`) - :meth:`matplotlib.axes.Axes.scatter` (with `inner="point"`) - :meth:`matplotlib.axes.Axes.plot` (with `inner="quart"` or `inner="box"`) Additionally, with `inner="box"`, the keywords `box_width`, `whis_width`, and `marker` receive special handling for the components of the "box" plot. .. versionadded:: v0.13.0 {ax_in} kwargs : key, value mappings Keyword arguments for the violin patches, passsed through to :meth:`matplotlib.axes.Axes.fill_between`. Returns ------- {ax_out} See Also -------- {boxplot} {stripplot} {swarmplot} {catplot} Examples -------- .. include:: ../docstrings/violinplot.rst rtukeyy&1|?皙?)r.r/r0rPrkr>r1rjrsrrrrr{rrrrrrrrrtrurvrLrrrrrc 2t|t|||||||} |tj}| jj r|S| dk(r| j } | jj| jdk(s|s| j| j||| j||| j||}| j|||\}}| j||}| r| nd} | j|||| t!|j"||i| }| j%||| j&}| j)| | | | |||||||||||| | j+|| j-|| j |S) Nr-rzr2r@r{r|r;r}rrrrrr1rr{rrrrrrrrrr<)r+r`rrrErrrIrKr>rrrurrrrrrrrrrr)!r4r.r/r0rPrkr>r1rjrsrrrrr{rrrrrrrrrtrurvrLrrrrrrrs! rXr&r&ps  aS)  A z WWY{{  !{{qxx M1 AHHEYGIIbII&11'9EI**5'9EGY,,ULAL#JIIgYX*IU  e   E ##IuajjAIMM  !!!&rr) IrYan Draw an enhanced box plot for larger datasets. This style of plot was originally named a "letter value" plot because it shows a large number of quantiles that are defined as "letter values". It is similar to a box plot in plotting a nonparametric representation of a distribution in which all features correspond to actual observations. By plotting more quantiles, it provides more information about the shape of the distribution, particularly in the tails. {categorical_narrative} Parameters ---------- {categorical_data} {input_params} {order_vars} {orient} {color} {palette} {saturation} {fill} {dodge} {width} {gap} {linewidth} {linecolor} width_method : {{"exponential", "linear", "area"}} Method to use for the width of the letter value boxes: - `"exponential"`: Represent the corresponding percentile - `"linear"`: Decrease by a constant amount for each box - `"area"`: Represent the density of data points in that box k_depth : {{"tukey", "proportion", "trustworthy", "full"}} or int The number of levels to compute and draw in each tail: - `"tukey"`: Use log2(n) - 3 levels, covering similar range as boxplot whiskers - `"proportion"`: Leave approximately `outlier_prop` fliers - `"trusthworthy"`: Extend to level with confidence of at least `trust_alpha` - `"full"`: Use log2(n) + 1 levels and extend to most extreme points outlier_prop : float Proportion of data expected to be outliers; used when `k_depth="proportion"`. trust_alpha : float Confidence threshold for most extreme level; used when `k_depth="trustworthy"`. showfliers : bool If False, suppress the plotting of outliers. {hue_norm} {log_scale} {native_scale} {formatter} {legend} box_kws: dict Keyword arguments for the box artists; passed to :class:`matplotlib.patches.Rectangle`. .. versionadded:: v0.12.0 line_kws: dict Keyword arguments for the line denoting the median; passed to :meth:`matplotlib.axes.Axes.plot`. .. versionadded:: v0.12.0 flier_kws: dict Keyword arguments for the scatter denoting the outlier observations; passed to :meth:`matplotlib.axes.Axes.scatter`. .. versionadded:: v0.12.0 {ax_in} kwargs : key, value mappings Other keyword arguments are passed to :class:`matplotlib.patches.Rectangle`, superceded by those in `box_kws`. Returns ------- {ax_out} See Also -------- {violinplot} {boxplot} {catplot} Notes ----- For a more extensive explanation, you can read the paper that introduced the plot: https://vita.had.co.nz/papers/letter-value-plot.html Examples -------- .. include:: ../docstrings/boxenplot.rst r)r.r/r0rPrkrrr>r1rjrr r{rrrtrurvrLrc 0t|t|||||| |}|tj}|jj r|S|j j|jdk(s|s|j|j|||j|||j| |}|j| | |\} }|j| ||t|j|| |} |j!| | |j"} |j%dd|jd | } |j'| d z| | |j)||| | |j+||j-||j |S)Nr-rzr@r{r|rjrPr~rr[rrzrr r{rrr1rr<)r+r`rrrErrIrKr>rrrurrrrrrrrrrr%rr)r4r.r/r0rPrkrrr>r1rjrr r{rrrtrurvrLrrrs rXr"r"s  aS)  A z WWY{{ {{qxx M1 AHHEYGIIbII&11'9EI**5'9EGYIIgYXI> 2::sE6 :E##IuajjAI h" ::c4 D MM !) MM rr) IrYa Draw a categorical scatterplot using jitter to reduce overplotting. A strip plot can be drawn on its own, but it is also a good complement to a box or violin plot in cases where you want to show all observations along with some representation of the underlying distribution. {categorical_narrative} Parameters ---------- {categorical_data} {input_params} {order_vars} jitter : float, `True`/`1` is special-cased Amount of jitter (only along the categorical axis) to apply. This can be useful when you have many points and they overlap, so that it is easier to see the distribution. You can specify the amount of jitter (half the width of the uniform random variable support), or use `True` for a good default. dodge : bool When a `hue` variable is assigned, setting this to `True` will separate the strips for different hue levels along the categorical axis and narrow the amount of space allotedto each strip. Otherwise, the points for each level will be plotted in the same strip. {orient} {color} {palette} size : float Radius of the markers, in points. edgecolor : matplotlib color, "gray" is special-cased Color of the lines around each point. If you pass `"gray"`, the brightness is determined by the color palette used for the body of the points. Note that `stripplot` has `linewidth=0` by default, so edge colors are only visible with nonzero line width. {linewidth} {hue_norm} {log_scale} {native_scale} {formatter} {legend} {ax_in} kwargs : key, value mappings Other keyword arguments are passed through to :meth:`matplotlib.axes.Axes.scatter`. Returns ------- {ax_out} See Also -------- {swarmplot} {boxplot} {violinplot} {catplot} Examples -------- .. include:: ../docstrings/stripplot.rst )r.r/r0rPrkrr>r1rjrr r{rrrtrurvrLr'rc lt|t|||||||}|tj}|jj r|S|j j|jdk(s|s|j|j|||j|||js|S|j| |}|j|| |\} }|j| || t|j |||}|j#| ||j$} |j'dd|jd | } | | d z } |j)t| d z| | |j+|||| |j-||j/||j|S)Nr-rzr@r{r|rrr[r rzrrr1r'rr<)r+r`rrrErrIrKr>rrrMrurrrrrrrrrrr>rr)r4r.r/r0rPrkrr>r1rjrr r{rrrtrurvrLr'rrrs rXr#r#s  aS)  A z WWY{{ {{qxx M1 AHHEYGIIbII& == 11'9EI**5'9EGYIIgYXI> 2::sE6 :E##IuajjAI h" ::c4 D2I  MM$ !) MM rr) IrYa Draw a categorical scatterplot with points adjusted to be non-overlapping. This function is similar to :func:`stripplot`, but the points are adjusted (only along the categorical axis) so that they don't overlap. This gives a better representation of the distribution of values, but it does not scale well to large numbers of observations. This style of plot is sometimes called a "beeswarm". A swarm plot can be drawn on its own, but it is also a good complement to a box or violin plot in cases where you want to show all observations along with some representation of the underlying distribution. {categorical_narrative} Parameters ---------- {categorical_data} {input_params} {order_vars} dodge : bool When a `hue` variable is assigned, setting this to `True` will separate the swarms for different hue levels along the categorical axis and narrow the amount of space allotedto each strip. Otherwise, the points for each level will be plotted in the same swarm. {orient} {color} {palette} size : float Radius of the markers, in points. edgecolor : matplotlib color, "gray" is special-cased Color of the lines around each point. If you pass `"gray"`, the brightness is determined by the color palette used for the body of the points. {linewidth} {log_scale} {native_scale} {formatter} {legend} {ax_in} kwargs : key, value mappings Other keyword arguments are passed through to :meth:`matplotlib.axes.Axes.scatter`. Returns ------- {ax_out} See Also -------- {boxplot} {violinplot} {stripplot} {catplot} Examples -------- .. include:: ../docstrings/swarmplot.rst r)rq_i)r.r/r0rPrkrerrorbarn_bootseedunitsrr>r1rjrsrrrrrrrtrurvrLrrrqrrrc tj||}|turd}t|t |||| | || | |} |t j }| jjr|S|dk(r| j}| jj| jdk(s|s| j| j||| j||| j||}| j!| ||\}}|r|nd}| j#|||| t%|j&|| || } d | jvrt(nt*}!|!|||| }"|in#t-|t.j0j2}| j5||||\}}| j7|"|||| |||| | j9|| j;|| j|S)Nrr.r/r0rrrzr2r@r{r|r;r}rrrr rCrrrr1rrrrr<)r _deprecate_cirrkr`rrrErrrIrKr>rrrurrrrrWrrrrdrprqrr[rr)#r4r.r/r0rPrkrrrrrrr>r1rjrsrrrrrrrtrurvrLrrrqrrrrragg_clsrCs# rXr(r( s""8R0HC  aSgF  A z WWY{{  !{{qxx M1 AHHEYGIIbII&11'9EI**5'9EGY#JIIgYX*IU 2663v* ME$, $; ASGHV$GJOb)9'399CSCS)TG,,Wh'RGWKK   rr) IrYaS Show point estimates and errors as rectangular bars. A bar plot represents an aggregate or statistical estimate for a numeric variable with the height of each rectangle and indicates the uncertainty around that estimate using an error bar. Bar plots include 0 in the axis range, and they are a good choice when 0 is a meaningful value for the variable to take. {categorical_narrative} Parameters ---------- {categorical_data} {input_params} {order_vars} {stat_api_params} {orient} {color} {palette} {saturation} {fill} {hue_norm} {width} {dodge} {gap} {log_scale} {native_scale} {formatter} {legend} {capsize} {err_kws} {ci} {errcolor} {errwidth} {ax_in} kwargs : key, value mappings Other parameters are passed through to :class:`matplotlib.patches.Rectangle`. Returns ------- {ax_out} See Also -------- {countplot} {pointplot} {catplot} Notes ----- For datasets where 0 is not a meaningful value, a :func:`pointplot` will allow you to focus on differences between levels of one or more categorical variables. It is also important to keep in mind that a bar plot shows only the mean (or other aggregate) value, but it is often more informative to show the distribution of values at each level of the categorical variables. In those cases, approaches such as a :func:`boxplot` or :func:`violinplot` may be more appropriate. Examples -------- .. include:: ../docstrings/barplot.rst )r.r/r0rPrkrrrrrrr1rjrrrDrErrtrur>rrvrLrrqrrrrc tj||}t|t|||| | ||| | dn| |}|t j }|j jr|S|jj|jdk(s|s|j|j|||j|||j| |}|j| | |\} }|j| ||t!|j"|| |} d|j vrt$nt&} | |||| }!|in#t)|t*j,j.}|j1||||j3|d||\}}|j5|!|||| ||| |j7||j9||j |S) NrC0rzr@r{r|rrrrCrDrErr1rrrr<)rrrkr`rrrErrIrKr>rrrurrrrrrrrrdrprqrrrRrr)"r4r.r/r0rPrkrrrrrrr1rjrrrDrErrtrur>rrvrLrrqrrrrrrrrCs" rXr'r' s""8R0H aSgF}du A z WWY{{ {{qxx M1 AHHEYGIIbII&11'9EI**5'9EGYIIgYXI> 277C 7E$, $; ASGHV$GJOb)9'399CSCS)TGudF3,,WdHgNGWMM rr) IrYa Show point estimates and errors using lines with markers. A point plot represents an estimate of central tendency for a numeric variable by the position of the dot and provides some indication of the uncertainty around that estimate using error bars. Point plots can be more useful than bar plots for focusing comparisons between different levels of one or more categorical variables. They are particularly adept at showing interactions: how the relationship between levels of one categorical variable changes across levels of a second categorical variable. The lines that join each point from the same `hue` level allow interactions to be judged by differences in slope, which is easier for the eyes than comparing the heights of several groups of points or bars. {categorical_narrative} Parameters ---------- {categorical_data} {input_params} {order_vars} {stat_api_params} {color} {palette} markers : string or list of strings Markers to use for each of the `hue` levels. linestyles : string or list of strings Line styles to use for each of the `hue` levels. dodge : bool or float Amount to separate the points for each level of the `hue` variable along the categorical axis. Setting to `True` will apply a small default. {log_scale} {native_scale} {orient} {capsize} {formatter} {legend} {err_kws} {ci} {errwidth} join : bool If `True`, connect point estimates with a line. .. deprecated:: v0.13.0 Set `linestyle="none"` to remove the lines between the points. scale : float Scale factor for the plot elements. .. deprecated:: v0.13.0 Control element sizes with :class:`matplotlib.lines.Line2D` parameters. {ax_in} kwargs : key, value mappings Other parameters are passed through to :class:`matplotlib.lines.Line2D`. .. versionadded:: v0.13.0 Returns ------- {ax_out} See Also -------- {barplot} {catplot} Notes ----- It is important to keep in mind that a point plot shows only the mean (or other estimator) value, but in many cases it may be more informative to show the distribution of values at each level of the categorical variables. In that case, other approaches such as a box or violin plot may be more appropriate. Examples -------- .. include:: ../docstrings/pointplot.rst r)r.r/r0rPrkr>r1rjrsrrrrrrrrtrurvrLrc f||d}t|rdnd}n%||d}t|rdnd}n| | tdt|t|||||||}|t j }|j jr|S|dk(r|j}|jj|jdk(s|s|j|j|| |j|| |j||}|j|||\}}| r| nd} |j!||| | t#|j$|||| }ddd |j}|j&d k(rd|j |<t)dgd| | |j*|<| dk7r6| dk(rdnd}|j |xxt-|j |z zcc<t/dd}|j1||| ||| di| |j3||j5||j|S)Nr/r;r.(Cannot pass values for both `x` and `y`.r-rzr2r@r{r|r}r8r6rrpercent probability proportionrrrsumrrrr<)r TypeErrorrkr`rrrErrrIrKr>rrrurrrrrWrDrr5rrr[rr)r4r.r/r0rPrkr>r1rjrsrrrrrrrrtrurvrLrrr count_axisdenomrCs rXr)r)7 s2 yQ]aAd 19aAd 1=BCC aS)  A z WWY{{  !{{qxx M1 AHHEYGIIbII&11'9EI**5'9EGY#JIIgYX*IU 2663vz BE%ahh/J~~"# JFMtT"AKK  wy(a J3q{{#3e#;;#ED9JKK   rr) IrYao Show the counts of observations in each categorical bin using bars. A count plot can be thought of as a histogram across a categorical, instead of quantitative, variable. The basic API and options are identical to those for :func:`barplot`, so you can compare counts across nested variables. Note that :func:`histplot` function offers similar functionality with additional features (e.g. bar stacking), although its default behavior is somewhat different. {categorical_narrative} Parameters ---------- {categorical_data} {input_params} {order_vars} {orient} {color} {palette} {saturation} {hue_norm} stat : {{'count', 'percent', 'proportion', 'probability'}} Statistic to compute; when not `'count'`, bar heights will be normalized so that they sum to 100 (for `'percent'`) or 1 (otherwise) across the plot. .. versionadded:: v0.13.0 {width} {dodge} {log_scale} {native_scale} {formatter} {legend} {ax_in} kwargs : key, value mappings Other parameters are passed through to :class:`matplotlib.patches.Rectangle`. Returns ------- {ax_out} See Also -------- histplot : Bin and count observations with additional options. {barplot} {catplot} Examples -------- .. include:: ../docstrings/countplot.rst strip)!r.r/r0rrkindrrrrrrrPrk row_order col_ordercol_wraprUaspectrtrurvr>r1rjrrrL legend_outsharexsharey margin_titles facet_kwsrqc! .d|"vr1d|d}#tj|#t|"jdgd}$gd}%|dvrt}&nt }&|dk(r!||d}d }n||d }d }n| | t d |&|t|||||| | | ||d k(r||dn||}'dD]4}(|(|'jvs|'j|("d|(d|'j|(<6|'jj|'j})|)jdd|)jjf})|'jjdd}*|'jjdd}+| i} tdy|)|+|*|||||||||d | },|'j }-|r|'j"|'j$dk(r|'j'|'j$| ||'j)|,||-s|,S|'j+||}|'j-|||\}}t/j0||!}|"jd||$vr|"jddrdnd }.|'j3||||.||dn|}|.d kr t5||.}|dvrXt7|"t8j:j<}"|'j?|"jdt@||'jB|"d<|"jd d!}/|"jd"||%vrd#nd$}0|0d$k(r|'jE}0d%|'jvr(|d&vrd'|d(}#tj|#d)*tF}1ntH}1|d+k(ry|"jd,d}2|"jK}3|3jMd-d.|3jMd/d0d1|3vr|3jd2d3d)z|3d1<|'jO|2|0||34n|d5k(r|"jd6d7}4|"jK}3|3jMd-d.d1|3vr|3jd2d3d)z|3d1<|3jMd/d0tQjR|3d1d8z |3d/<|'jU|0||4|39n}|d:k(r|"jK}3|3jd;d0}5|3jdd}6|3jdd3}9|'j?|3jd?d$||'jB}:|'jW|/|0|5|6|7||:|8|9|3@ n|dAk(r|"jK}3|3jd;d0}5|3jdd}6|3jdBd#};|3jdCd:}<|3jdDdE}=|3jdFd#}>|3jdGtX}?|3jdHtX}@|'j[|?|@|=|>\}=}>|'j]|3jdItX|3jdJdK}At|3jdLd)|3jdMdN|3jdOd |AP}B|3jdQijK}C|3jd/d}8|3jd?d$}:|'j?|:||'jB}:|'j_|/|0|5|;||6|:|8|<|=|>|B|C|3Rn|dSk(rA|"jK}3|3jd;d0}5|3jdd}6|3jd?d$}:|3jd/d}8|3jdTdU}D|3jdVdW}E|3jdXdY}F|3jdZd7}G|3jd[d}H|3jd\i}I|3jd]i}J|3jd^i}KdG|3vr|'ja|3dGE}E|'j?|:||'jB}:|'jc|/|0|5|6||:|8EDFGHIJK|3_n|d k(r|1||| | `}L|"jdat@}M|"jdbt@}N|'je|"jdGtX|"jdctX|"|'jgt7|"jddit8jhjjd|"jdetX|"jdfd0g\}O}P|'jm|L|M|N|0||P|O|"hn|dik(r|1||| | `}L|'jgt7|"jddit8jhjj|"jdjtX|"jdetX|"jdfd0k\}O}P|"jd;d0}5|"jdd}6|'jo|L|0|/|5||6|P|O|"l n|dk(rtIdmdn}Ldd do|'j$}Qd |'j|Q<gdp}Rtqdq|R|"jdqd}S|S|'j|Q<|Sdk7r6Sdrk(rdNnd }T|'jQxxts|'j|Tz zcc<|"jd;d0}5|"jdd}6|'joL|0|/|5||6d0i|"l nds|dt}#t |#|,jtjvD]}U|'jy|U|'j$u!|,j{|'jjd |'jjd|,j}|,j|,jtjvD]}U|,j|Ud|U_A|d$k(r|'j xr|'jdvk7}Vn t|}VVr,|,j|'jjdw|x|||,_F|,S)zNrzXcatplot is a figure-level function and does not accept target axes. You may wish to try r)rWrrHrr)rswarmr)rWrrrr/r;r.r)r.r/r0rrrrrrrz)rrrr9rr) r4rrrrrrrrrrUrr@r{r|rsrTryr})rrr rrrFr2r)rWrz0The `weights` parameter has no effect with kind=.rzr\rrrr[r{rrrrrrr'rrrrHrrOrTrrrrr rrrrrrrrrrrrr)rrrrr rrrrrrrrrrrrrrrrDrErrrr)rrrrWr)rrrrrrr8rrrzInvalid `kind`: zV. Options are 'strip', 'swarm', 'box', 'boxen', 'violin', 'bar', 'count', and 'point'.r<r6r0)r label_orderro)Grgrh UserWarningrHrkr+ ValueErrorr`r5rErFlocr: duplicatedrKrrMrIr>rrrurrrrrrrrdrPathCollectionrr rrrrrrrr%rr8r>rr rrr3rrrrrprqrRr[rraxesflatrset_axis_labels set_titles tight_layout_update_legend_datalegend_r^rDr add_legendr4)Wr4r.r/r0rrrrrrrrrrPrkrrrrUrrtrurvr>r1rjrrrLrrrrrrqrrqdesaturated_kindsundodged_kindsPlotterrr facet_datacol_namerow_namegrMrsrrrrrr'rrrOr{rrr rrrrrrr r rrrrrrrrrCrDrErrr stat_optionsrrrrsW rXr!r! s  v~337&> c;' 4B0N (((% w 9FA ]qyFA ]q}GH H 1#3CuW go'/emdQV A* !++ !++c"2":!"3%qzAKK * ##AKK#8JJ$6$6$A$A$C#C CDJ{{ud+H{{ud+H   X8hy]f     A--K 1;;qxx0MA AHHEYGIIa9I% 11'9EI**5'9EGY""8R0H))fjj.FAJIIgYX*IU { 5 >uj1E !!!&#//*H*HI11 JJ{G ,eQZZ { JJw $E JJw)?V LE !1;; ' 'DTHANC MM#! ,$$ wHd+;;=Ha(K+ h $LL3q8HSM    jj4 ;;=Ha( h $LL3q8HSM   {A . 6$&GGHSM$:R$?H[ ! #   ;;=ll5!$||FD)||FC(LLd3 LLa0 '' LLf -uajj      ;;=ll5!$||FD) We, We,||NF; ll=%8  Wj1LLj9 $%$>$> 9lK% ! k++ LLz *HLLg,N  UA&\\*c2ll;2  LLb1668 LLd3 LLf5 '' 5!**E  %#  " ;;=ll5!$||FD)LLf5 LLd3 ,,y'2||NMB ||NE: ll=$7 \\,5 ,,y"-LLb1 << B/ h 44!<L'' 5!**E  %%#!!  & YdK **Y0ZZ g6 "" JJw + JJvz *  00 VZZ 26 8H8H I ZZ J7JJy!, 1  !!   YdK 00 VZZ 26 8H8H IZZ J7ZZ J7JJy!, 1  jj"zz&$' !   '= S)!((3 "# JH v|VZZ5PQ"& J 7?9,C!E KK #s1;;'7%'? ? #jj"zz&$' !  th'E E offkk. 2AHH-.akkooc*AKKOOC,@ALLNNNffkk b! ***Gq~~/G 6l  1;;??51y I  HrYa Figure-level interface for drawing categorical plots onto a FacetGrid. This function provides access to several axes-level functions that show the relationship between a numerical and one or more categorical variables using one of several visual representations. The `kind` parameter selects the underlying axes-level function to use. Categorical scatterplots: - :func:`stripplot` (with `kind="strip"`; the default) - :func:`swarmplot` (with `kind="swarm"`) Categorical distribution plots: - :func:`boxplot` (with `kind="box"`) - :func:`violinplot` (with `kind="violin"`) - :func:`boxenplot` (with `kind="boxen"`) Categorical estimate plots: - :func:`pointplot` (with `kind="point"`) - :func:`barplot` (with `kind="bar"`) - :func:`countplot` (with `kind="count"`) Extra keyword arguments are passed to the underlying function, so you should refer to the documentation for each to see kind-specific options. {categorical_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. Parameters ---------- {categorical_data} {input_params} row, col : names of variables in `data` or vector data Categorical variables that will determine the faceting of the grid. kind : str The kind of plot to draw, corresponds to the name of a categorical axes-level plotting function. Options are: "strip", "swarm", "box", "violin", "boxen", "point", "bar", or "count". {stat_api_params} {order_vars} 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. {col_wrap} {height} {aspect} {native_scale} {formatter} {orient} {color} {palette} {hue_norm} {legend} {legend_out} {share_xy} {margin_titles} facet_kws : dict 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 ------- :class:`FacetGrid` Returns the :class:`FacetGrid` object with the plot on it for further tweaking. Examples -------- .. include:: ../docstrings/catplot.rst c<eZdZdZd dZdZdZdZdZdZ dZ y ) r8z6Modifies a scatterplot artist to show a beeswarm plot.c.||_||_||_yr)r>rr')rOr>rr's rXrCzBeeswarm.__init__ s  &rYc|j}|jj}|j}|jdk(rdnd}||dd|f<|j \}}|j j|} |jdk(r | ddddgf} |j} | jdk(r#tj| | jd} |jj} tj| | zdz |dz z} tj | | f} tj"| dddf} | | }tj$|}|j'||| <|jdk(r |ddddgf}n |ddddf}|j j)j|j \}}t+||j\}}|jdk(r|j-||||n|j-|||||jdk(r%|j/tj ||fy|j/tj ||fy)z?Swarm `points`, a PathCollection, around the `center` position.r/r;rNrzr)rr<dpir9r>rr1r get_sizesrrrepeatr: get_linewidthrr8c_argsort empty_liker6invertedr add_gutters set_offsets)rOr$r(rr orig_xy_datacat_idx orig_x_data orig_y_dataorig_xysizesrradiisorterorig_xyrnew_xyrnew_xy new_x_data new_y_datat_fwdt_invs rX__call__zBeeswarm.__call__ s9[[iimm))+ {{c)!q#) QZ $0>> [,,((6 ;;# a!Qi(G  " ::?IIeW]]1%56E##%**,$&!+sRx8%%'GAqDM*6?--)--1 ;;# QAY'FQU^F!#!6!6!8!B!B6!J!L!L J0DKK@ u ;;#    Z >   Z > ;;#    ruu[*%<= >   ruuZ%<= >rYc\|d}tj|d}|ddD]}|j||}|j||}tj|dddf|z }|tj |}|j ||}tj||g}|S)z.Adjust x position of points to avoid overlaps.)rrrr;N)r atleast_2d could_overlapposition_candidatesabsrfirst_non_overlapping_candidatevstack) rOrmidlinerxyr_i neighbors candidatesr new_xyr_is rXr6zBeeswarm.beeswarm s4. hqk*ab\ 2E**5%8I11%CJffZ1-78G#BJJw$78J<Find the first candidate that does not overlap with the swarm.rNr;rzzQ a= 1o 1o 1o  E!MCcs"Bs"B99R=299R=8L;#45J  VVLJ$>?N ! $ J  rYc|jdz }||||z }||k}|jr|||<||||z}||kD} | jr||| <| |zjt|z } | |jkDr+dj | } t j| t|S)z2Stop points from extending beyond their territory.rzzi{:.1%} of the points cannot be placed; you may want to decrease the size of the markers or use stripplot.) rrrrr'formatrgrhr) rOr$r( trans_fwd trans_inv half_width low_gutteroff_low high_gutteroff_high gutter_proprqs rXrzBeeswarm.add_gutters5 sZZ!^ y0:=> :% ;;=(F7O & 1J >? K' <<>*F8 ')..03v;> )) )Hf[!  MM#{ + rYN)r.rr) rbrcrd__doc__rCrr6rrrrrorYrXr8r8 s+@' :?x@ )$" BrYr8BoxPlotArtistsz$box median whiskers caps fliers meanc<eZdZdZdZdZdZdZdZdZ dZ y ) rc(|d|_|d|_|d|_|d|_|d|_|d|_d|_g|j|j|j|j|j|j |_y)NrirmwhiskersrnrXmeans)rirmr)rnrXr*_label _children)rO artist_dicts rXrCzBoxPlotContainer.__init__Q s ) "9- #J/ ' !(+  )   ZZ \\ ]] YY  [[  ZZ  rYc4dt|jdS)Nz)rrirOs rX__repr__zBoxPlotContainer.__repr__d s/DJJ/@HHrYc td|zd|zdz}t|jr|j|ng|jr|j|ng|jr|j|ng|j r|j |ng|j r|j |ng|jr|j|SgS)Nrz)slicer&rirmr)rnrXr*)rOidx pair_slices rX __getitem__zBoxPlotContainer.__getitem__g s1s7AGaK0 #zzDJJsOr!%DLL 2)-DMM* %B%)YYDIIj !B $ DKK "jjDJJsO   /1   rYc#pKfdttjDEd{y7w)Nc3(K|] }| ywrro)rrrOs rXrz,BoxPlotContainer.__iter__..s s<DGrZsv"-2*(4HH&   9 +3 W&-W&t(505 `!" ` `" #`, -`6 7`d e`r   s`F  G`N  O`Z [`h i`t  u`| }`J K`X  Y`d  e`p  q`z   {`N O`V W`b c`t u`B C`P   Q`d  e`p  q`x  y`D  E`J K`P Q`X Y``  a`f g`l m`r  s`x y`D% =Dd$$ tTc vTQU d =@:&:: t u:%t$u:%| LDd$$ tTc uBf!f!cU TT zjtL^lVll X Yl%X$Yl% ` IDd$$ tTc TTeQUddRV TTD IX[F[[ v w[%v$w[% ~ :Dd$$ uTt g Tf :z=F== z {=%z${=% B =Dd$$ D$ da$$$v3 =@;F;; v w;%v$w;% ~ FDd$$z$T T4C Bf!t$vq$J FRB&BB D EB%D$EB%L ?Dd$$z$T dT7et% d64JZz ?DOFOO ^ _O%^$_O% f KDd$$ tTct &a4e6d K\3F33 f g3%f$g3% n C Dd$Wz$T  !AE4tTD d44JC L M&MM Z [M%Z$[M%`xxv,.TU11rY