Ë
    {�h07  ã                   óø   — d dl mZmZ d dlmZ d dlmZ  ej                  d«      Z ej                  d«      Z	 ej                  d«      Z
 ej                  d«      ZdZd	Zd
„ Zddddedddfd„Z G d„ de«      Zy)é    )Ú
exceptionsÚoptional_imports)Úutils)Ú
graph_objsÚnumpyÚpandasÚscipyzscipy.statszprobability densityÚprobabilityc                 óB  — t         f}t        r|t        j                  fz  }t        r(|t        j                  j
                  j                  fz  }t        | d   |«      st        j                  d«      ‚d}||vrt        j                  d«      ‚t        st        d«      ‚y)zÃ
    Distplot-specific validations

    :raises: (PlotlyError) If hist_data is not a list of lists
    :raises: (PlotlyError) If curve_type is not valid (i.e. not 'kde' or
        'normal').
    r   z¼Oops, this function was written to handle multiple datasets, if you want to plot just one, make sure your hist_data variable is still a list of lists, i.e. x = [1, 2, 3] -> x = [[1, 2, 3]])ÚkdeÚnormalz/curve_type must be defined as 'kde' or 'normal'z,FigureFactory.create_distplot requires scipyN)ÚlistÚnpÚndarrayÚpdÚcoreÚseriesÚSeriesÚ
isinstancer   ÚPlotlyErrorr	   ÚImportError)Ú	hist_dataÚ
curve_typeÚhist_data_typesÚ
curve_optss       ú]/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/plotly/figure_factory/_distplot.pyÚvalidate_distplotr      s�   € ô �g€OÝ	ØœBŸJ™J˜=Ñ(ˆÝ	ØœBŸG™GŸN™N×1Ñ1Ð3Ñ3ˆä�i ‘l OÔ4Ü×$Ñ$ð+ó
ð 	
ð #€JØ˜Ñ#Ü×$Ñ$Ø@ó
ð 	
õ ÜÐHÓIÐIð ó    ç      ð?r   NTc
                 ó’  — |€g }|€g }t        | |«       t        j                  | |«       t        |t        t
        f«      r|gt        | «      z  }g }
|r2t        | ||||||||«	      j                  «       }|
j                  |«       |rY|dk(  r"t        | ||||||||«	      j                  «       }n!t        | ||||||||«	      j                  «       }|
j                  |«       |	rƒt        | ||||||||«	      j                  «       }|
j                  |«       t        j                  ddt        d¬«      t        ddgdd	¬
«      t        ddgdd¬«      t        ddgddd	¬«      ¬«      }n@t        j                  ddt        d¬«      t        ddgdd	¬
«      t        ddgdd¬«      ¬«      }t!        |
g «      }
t        j"                  |
|¬«      S )aB  
    Function that creates a distplot similar to seaborn.distplot;
    **this function is deprecated**, use instead :mod:`plotly.express`
    functions, for example

    >>> import plotly.express as px
    >>> tips = px.data.tips()
    >>> fig = px.histogram(tips, x="total_bill", y="tip", color="sex", marginal="rug",
    ...                    hover_data=tips.columns)
    >>> fig.show()


    The distplot can be composed of all or any combination of the following
    3 components: (1) histogram, (2) curve: (a) kernel density estimation
    or (b) normal curve, and (3) rug plot. Additionally, multiple distplots
    (from multiple datasets) can be created in the same plot.

    :param (list[list]) hist_data: Use list of lists to plot multiple data
        sets on the same plot.
    :param (list[str]) group_labels: Names for each data set.
    :param (list[float]|float) bin_size: Size of histogram bins.
        Default = 1.
    :param (str) curve_type: 'kde' or 'normal'. Default = 'kde'
    :param (str) histnorm: 'probability density' or 'probability'
        Default = 'probability density'
    :param (bool) show_hist: Add histogram to distplot? Default = True
    :param (bool) show_curve: Add curve to distplot? Default = True
    :param (bool) show_rug: Add rug to distplot? Default = True
    :param (list[str]) colors: Colors for traces.
    :param (list[list]) rug_text: Hovertext values for rug_plot,
    :return (dict): Representation of a distplot figure.

    Example 1: Simple distplot of 1 data set

    >>> from plotly.figure_factory import create_distplot

    >>> hist_data = [[1.1, 1.1, 2.5, 3.0, 3.5,
    ...               3.5, 4.1, 4.4, 4.5, 4.5,
    ...               5.0, 5.0, 5.2, 5.5, 5.5,
    ...               5.5, 5.5, 5.5, 6.1, 7.0]]
    >>> group_labels = ['distplot example']
    >>> fig = create_distplot(hist_data, group_labels)
    >>> fig.show()


    Example 2: Two data sets and added rug text

    >>> from plotly.figure_factory import create_distplot
    >>> # Add histogram data
    >>> hist1_x = [0.8, 1.2, 0.2, 0.6, 1.6,
    ...            -0.9, -0.07, 1.95, 0.9, -0.2,
    ...            -0.5, 0.3, 0.4, -0.37, 0.6]
    >>> hist2_x = [0.8, 1.5, 1.5, 0.6, 0.59,
    ...            1.0, 0.8, 1.7, 0.5, 0.8,
    ...            -0.3, 1.2, 0.56, 0.3, 2.2]

    >>> # Group data together
    >>> hist_data = [hist1_x, hist2_x]

    >>> group_labels = ['2012', '2013']

    >>> # Add text
    >>> rug_text_1 = ['a1', 'b1', 'c1', 'd1', 'e1',
    ...       'f1', 'g1', 'h1', 'i1', 'j1',
    ...       'k1', 'l1', 'm1', 'n1', 'o1']

    >>> rug_text_2 = ['a2', 'b2', 'c2', 'd2', 'e2',
    ...       'f2', 'g2', 'h2', 'i2', 'j2',
    ...       'k2', 'l2', 'm2', 'n2', 'o2']

    >>> # Group text together
    >>> rug_text_all = [rug_text_1, rug_text_2]

    >>> # Create distplot
    >>> fig = create_distplot(
    ...     hist_data, group_labels, rug_text=rug_text_all, bin_size=.2)

    >>> # Add title
    >>> fig.update_layout(title='Dist Plot') # doctest: +SKIP
    >>> fig.show()


    Example 3: Plot with normal curve and hide rug plot

    >>> from plotly.figure_factory import create_distplot
    >>> import numpy as np

    >>> x1 = np.random.randn(190)
    >>> x2 = np.random.randn(200)+1
    >>> x3 = np.random.randn(200)-1
    >>> x4 = np.random.randn(210)+2

    >>> hist_data = [x1, x2, x3, x4]
    >>> group_labels = ['2012', '2013', '2014', '2015']

    >>> fig = create_distplot(
    ...     hist_data, group_labels, curve_type='normal',
    ...     show_rug=False, bin_size=.4)


    Example 4: Distplot with Pandas

    >>> from plotly.figure_factory import create_distplot
    >>> import numpy as np
    >>> import pandas as pd

    >>> df = pd.DataFrame({'2012': np.random.randn(200),
    ...                    '2013': np.random.randn(200)+1})
    >>> fig = create_distplot([df[c] for c in df.columns], df.columns)
    >>> fig.show()
    r   ÚoverlayÚclosestÚreversed)Ú
traceorderg        r   Úy2F)ÚdomainÚanchorÚzerolinegffffffÖ?é   Úfree)r&   r'   Úpositionr   g      Ð?Úx1)r&   r'   ÚdtickÚshowticklabels)ÚbarmodeÚ	hovermodeÚlegendÚxaxis1Úyaxis1Úyaxis2)r/   r0   r1   r2   r3   )ÚdataÚlayout)r   r   Úvalidate_equal_lengthr   ÚfloatÚintÚlenÚ	_DistplotÚ	make_histÚappendÚmake_normalÚmake_kdeÚmake_rugr   ÚLayoutÚdictÚsumÚFigure)r   Úgroup_labelsÚbin_sizer   ÚcolorsÚrug_textÚhistnormÚ	show_histÚ
show_curveÚshow_rugr5   ÚhistÚcurveÚrugr6   s                  r   Úcreate_distplotrP   2   s  € ðv €~ØˆØÐØˆä�i Ô,Ü	×Ñ 	¨<Ô8ä�(œU¤C˜LÔ)Ø�:¤ I£Ñ.ˆà€DÙäØØØØØØØØØó

÷ ‰)‹+ð 	ð 	�‰�DÔáà˜Ò!ÜØØØØØØØØØó
÷ ‰k‹mñ ô ØØØØØØØØØó
÷ ‰h‹jð ð 	�‰�EÔáäØØØØØØØØØó

÷ ‰(‹*ð 	ð 	�‰�CÔÜ×"Ñ"ØØÜ :Ô.Ü  S˜z°$ÀÔGÜ  a˜y°À#ÔFÜ  4˜y°¸QÈuÔUô
‰ô ×"Ñ"ØØÜ :Ô.Ü  S˜z°$ÀÔGÜ  Q˜x°ÀÔEô
ˆô ˆt�R‹=€DÜ×Ñ $¨vÔ6Ð6r   c                   ó.   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zy)r;   z?
    Refer to TraceFactory.create_distplot() for docstring
    c
                 ó
  — || _         || _        || _        || _        || _        |	| _        t        |«      | _        |r|| _        nd g| j                  z  | _        g | _	        g | _
        |r|| _        n	g d¢| _        d g| j                  z  | _        d g| j                  z  | _        | j                   D ]P  }
| j                  j                  t        |
«      dz  «       | j                  j                  t!        |
«      dz  «       ŒR y )N)
zrgb(31, 119, 180)zrgb(255, 127, 14)zrgb(44, 160, 44)zrgb(214, 39, 40)zrgb(148, 103, 189)zrgb(140, 86, 75)zrgb(227, 119, 194)zrgb(127, 127, 127)zrgb(188, 189, 34)zrgb(23, 190, 207)r   )r   rI   rE   rF   rJ   rK   r:   Útrace_numberrH   ÚstartÚendrG   Úcurve_xÚcurve_yr=   ÚminÚmax)Úselfr   rI   rE   rF   r   rG   rH   rJ   rK   Útraces              r   Ú__init__z_Distplot.__init__  së   € ð #ˆŒØ ˆŒØ(ˆÔØ ˆŒØ"ˆŒØ$ˆŒÜ 	›NˆÔÙØ$ˆD�Mà!˜F T×%6Ñ%6Ñ6ˆDŒMàˆŒ
ØˆŒÙØ ˆD�KòˆDŒKð �v × 1Ñ 1Ñ1ˆŒØ�v × 1Ñ 1Ñ1ˆŒà—^‘^ò 	.ˆEØ�J‰J×Ñœc %›j¨3Ñ.Ô/Ø�H‰H�O‰OœC ›J¨Ñ,Õ-ñ	.r   c                 ó®  — dg| j                   z  }t        | j                   «      D ]¬  }t        d| j                  |   dd| j                  | j
                  |   | j
                  |   t        | j                  |t        | j                  «      z     ¬«      dt        | j                  |   | j                  |   | j                  |   ¬«      d¬	«      ||<   Œ® |S )
zŒ
        Makes the histogram(s) for FigureFactory.create_distplot().

        :rtype (list) hist: list of histogram representations
        NÚ	histogramr,   Úy1©ÚcolorF)rT   rU   Úsizegffffffæ?)ÚtypeÚxÚxaxisÚyaxisrI   ÚnameÚlegendgroupÚmarkerÚautobinxÚxbinsÚopacity)rS   ÚrangerB   r   rI   rE   rG   r:   rT   rU   rF   )rZ   rM   Úindexs      r   r<   z_Distplot.make_hist?  sÏ   € ð ˆv˜×)Ñ)Ñ)ˆä˜4×,Ñ,Ó-ò 	ˆEÜØ Ø—.‘. Ñ'ØØØŸ™Ø×&Ñ& uÑ-Ø ×-Ñ-¨eÑ4Ü $§+¡+¨e´c¸$¿+¹+Ó6FÑ.FÑ"GÔHØÜØŸ*™* UÑ+ØŸ™ ™ØŸ™ uÑ-ôð
 ôˆD�ŠKð	ð$ ˆr   c                 óJ  — dg| j                   z  }t        | j                   «      D ]Ô  }t        d«      D �cg c]7  }| j                  |   || j                  |   | j                  |   z
  z  dz  z   ‘Œ9 c}| j                  |<   t        j                  | j                  |   «      | j                  |   «      | j                  |<   | j                  t        k(  sŒ±| j                  |xx   | j                  |   z  cc<   ŒÖ t        | j                   «      D ]‰  }t        d| j                  |   | j                  |   ddd| j                  |   | j                  |   | j                  rdndt        | j                  |t!        | j                  «      z     ¬	«      ¬
«
      ||<   Œ‹ |S c c}w )zÏ
        Makes the kernel density estimation(s) for create_distplot().

        This is called when curve_type = 'kde' in create_distplot().

        :rtype (list) curve: list of kde representations
        Néô  Úscatterr,   r_   ÚlinesFTr`   ©
rc   rd   Úyre   rf   Úmoderg   rh   Ú
showlegendri   )rS   rm   rT   rU   rV   Úscipy_statsÚgaussian_kder   rW   rI   ÚALTERNATIVE_HISTNORMrF   rB   rE   rJ   rG   r:   )rZ   rN   rn   rd   s       r   r?   z_Distplot.make_kde[  s‡  € ð �˜×*Ñ*Ñ*ˆÜ˜4×,Ñ,Ó-ò 
	<ˆEô ˜s›ö#àð —
‘
˜5Ñ! A¨¯©°%©¸4¿:¹:ÀeÑ;LÑ)LÑ$MÐPSÑ$SÓSò#ˆD�L‰L˜Ñô #.×":Ñ":¸4¿>¹>È%Ñ;PÓ"QØ—‘˜UÑ#ó#ˆD�L‰L˜Ñð �}‰}Ô 4Ó4Ø—‘˜UÓ# t§}¡}°UÑ';Ñ;Ô#ð
	<ô ˜4×,Ñ,Ó-ò 	ˆEÜØØ—,‘,˜uÑ%Ø—,‘,˜uÑ%ØØØØ×&Ñ& uÑ-Ø ×-Ñ-¨eÑ4Ø$(§N¢N™5¸Ü $§+¡+¨e´c¸$¿+¹+Ó6FÑ.FÑ"GÔHôˆE�%ŠLð	ð ˆùò1#s   ¶<F c                 óú  — dg| j                   z  }dg| j                   z  }dg| j                   z  }t        | j                   «      D �]  }t        j                  j	                  | j
                  |   «      \  ||<   ||<   t        d«      D �cg c]7  }| j                  |   || j                  |   | j                  |   z
  z  dz  z   ‘Œ9 c}| j                  |<   t        j                  j                  | j                  |   ||   ||   ¬«      | j                  |<   | j                  t        k(  sŒè| j                  |xx   | j                  |   z  cc<   �Œ t        | j                   «      D ]‰  }t        d| j                  |   | j                  |   ddd| j                  |   | j                  |   | j                   rdnd	t        | j"                  |t%        | j"                  «      z     ¬
«      ¬«
      ||<   Œ‹ |S c c}w )zÎ
        Makes the normal curve(s) for create_distplot().

        This is called when curve_type = 'normal' in create_distplot().

        :rtype (list) curve: list of normal curve representations
        Nrp   )ÚlocÚscalerq   r,   r_   rr   FTr`   rs   )rS   rm   rw   ÚnormÚfitr   rT   rU   rV   ÚpdfrW   rI   ry   rF   rB   rE   rJ   rG   r:   )rZ   rN   ÚmeanÚsdrn   rd   s         r   r>   z_Distplot.make_normal  sà  € ð �˜×*Ñ*Ñ*ˆØˆv˜×)Ñ)Ñ)ˆØˆV�d×'Ñ'Ñ'ˆä˜4×,Ñ,Ó-ó 	<ˆEÜ%0×%5Ñ%5×%9Ñ%9¸$¿.¹.ÈÑ:OÓ%PÑ"ˆD�‰K˜˜E™ô ˜s›ö#àð —
‘
˜5Ñ! A¨¯©°%©¸4¿:¹:ÀeÑ;LÑ)LÑ$MÐPSÑ$SÓSò#ˆD�L‰L˜Ñô #.×"2Ñ"2×"6Ñ"6Ø—‘˜UÑ#¨¨e©¸B¸u¹Ið #7ó #ˆD�L‰L˜Ñð �}‰}Ô 4Ó4Ø—‘˜UÓ# t§}¡}°UÑ';Ñ;Õ#ð	<ô ˜4×,Ñ,Ó-ò 	ˆEÜØØ—,‘,˜uÑ%Ø—,‘,˜uÑ%ØØØØ×&Ñ& uÑ-Ø ×-Ñ-¨eÑ4Ø$(§N¢N™5¸Ü $§+¡+¨e´c¸$¿+¹+Ó6FÑ.FÑ"GÔHôˆE�%ŠLð	ð ˆùò1#s   Â<G8c                 óÒ  — dg| j                   z  }t        | j                   «      D ]¾  }t        d| j                  |   | j                  |   gt        | j                  |   «      z  ddd| j                  |   | j                  |   | j                  s| j                  rdnd| j                  |   t        | j                  |t        | j                  «      z     d¬	«      ¬
«      ||<   ŒÀ |S )z{
        Makes the rug plot(s) for create_distplot().

        :rtype (list) rug: list of rug plot representations
        Nrq   r,   r%   ÚmarkersFTzline-ns-open)ra   Úsymbol)rc   rd   rt   re   rf   ru   rg   rh   rv   Útextri   )
rS   rm   rB   r   rE   r:   rJ   rK   rH   rG   )rZ   rO   rn   s      r   r@   z_Distplot.make_rug§  sÞ   € ð ˆf�t×(Ñ(Ñ(ˆÜ˜4×,Ñ,Ó-ò 	ˆEäØØ—.‘. Ñ'Ø×%Ñ% eÑ,Ð-´°D·N±NÀ5Ñ4IÓ0JÑJØØØØ×&Ñ& uÑ-Ø ×-Ñ-¨eÑ4Ø%)§^¢^°t·²™EÈDØ—]‘] 5Ñ)ÜØŸ+™+ e¬c°$·+±+Ó.>Ñ&>Ñ?ÈôôˆC�ŠJð	ð" ˆ
r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r\   r<   r?   r>   r@   © r   r   r;   r;   
  s#   „ ñò..ò`ò8"òH&óPr   r;   )Úplotlyr   r   Úplotly.figure_factoryr   Úplotly.graph_objsr   Ú
get_moduler   r   r	   rw   ÚDEFAULT_HISTNORMry   r   rP   Úobjectr;   rŠ   r   r   ú<module>r‘      s    ðß /Ý 'Ý (ð !Ð× Ñ  Ó)€Ø Ð× Ñ  Ó*€Ø#Ð×#Ñ# GÓ,€Ø)Ð×)Ñ)¨-Ó8€ð )Ð Ø$Ð òJðJ ØØØØØØØóU7ôpu�õ ur   