Ë
    {�hq(  ã                   ó¦   — d dl mZ d dlmZmZ d dlmZ d dlm	Z	 d dl
mZ  ej                  d«      Zd„ Z	 	 	 	 	 	 	 dd„Zd	„ Zd
„ Z G d„ de«      Zy)é    N)Ú
exceptionsÚoptional_imports)Úutils)Ú
graph_objs)ÚColorscaleValidatorÚnumpyc                 óª  — |�qt        |t        «      rat        j                  | |«       t	        t        | «      «      D ]4  }t        | |   «      t        ||   «      k7  sŒ!t        j                  d«      ‚ |r/t        |«      t        | d   «      k7  rt        j                  d«      ‚|r-t        |«      t        | «      k7  rt        j                  d«      ‚yy)a(  
    Annotated-heatmap-specific validations

    Check that if a text matrix is supplied, it has the same
    dimensions as the z matrix.

    See FigureFactory.create_annotated_heatmap() for params

    :raises: (PlotlyError) If z and text matrices do not  have the same
        dimensions.
    Nz*z and text should have the same dimensionsr   zMoops, the x list that you provided does not match the width of your z matrix zNoops, the y list that you provided does not match the length of your z matrix )Ú
isinstanceÚlistr   Úvalidate_equal_lengthÚrangeÚlenr   ÚPlotlyError)ÚzÚxÚyÚannotation_textÚlsts        úf/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/plotly/figure_factory/_annotated_heatmap.pyÚvalidate_annotated_heatmapr      sÒ   € ð Ð"¤z°/Ä4Ô'HÜ×#Ñ# A Ô7Üœ˜Q›“=ò 	ˆCÜ�1�S‘6‹{œc /°#Ñ"6Ó7Ó7Ü ×,Ñ,ØCóð ð	ñ 	Üˆq‹6”S˜˜1™“YÒÜ×(Ñ(ð*óð ñ 	Üˆq‹6”S˜“VÒÜ×(Ñ(ð+óð ð ð 	ó    c                 óÂ  — |�|ng }t        | |||«       t        «       }	|	j                  |«      }t        | ||||||fi |¤Žj	                  «       }
|s|r;t        dd| |||||dœ|¤Ž}t        |
t        dddd¬«      t        ddd¬	«      ¬
«      }n8t        dd| |||dœ|¤Ž}t        |
t        dddd¬«      t        ddd¬«      ¬
«      }|g}t        j                  ||¬«      S )a±  
    **deprecated**, use instead
    :func:`plotly.express.imshow`.

    Function that creates annotated heatmaps

    This function adds annotations to each cell of the heatmap.

    :param (list[list]|ndarray) z: z matrix to create heatmap.
    :param (list) x: x axis labels.
    :param (list) y: y axis labels.
    :param (list[list]|ndarray) annotation_text: Text strings for
        annotations. Should have the same dimensions as the z matrix. If no
        text is added, the values of the z matrix are annotated. Default =
        z matrix values.
    :param (list|str) colorscale: heatmap colorscale.
    :param (list) font_colors: List of two color strings: [min_text_color,
        max_text_color] where min_text_color is applied to annotations for
        heatmap values < (max_value - min_value)/2. If font_colors is not
        defined, the colors are defined logically as black or white
        depending on the heatmap's colorscale.
    :param (bool) showscale: Display colorscale. Default = False
    :param (bool) reversescale: Reverse colorscale. Default = False
    :param kwargs: kwargs passed through plotly.graph_objs.Heatmap.
        These kwargs describe other attributes about the annotated Heatmap
        trace such as the colorscale. For more information on valid kwargs
        call help(plotly.graph_objs.Heatmap)

    Example 1: Simple annotated heatmap with default configuration

    >>> import plotly.figure_factory as ff

    >>> z = [[0.300000, 0.00000, 0.65, 0.300000],
    ...      [1, 0.100005, 0.45, 0.4300],
    ...      [0.300000, 0.00000, 0.65, 0.300000],
    ...      [1, 0.100005, 0.45, 0.00000]]

    >>> fig = ff.create_annotated_heatmap(z)
    >>> fig.show()
    Úheatmap)Útyper   r   r   Ú
colorscaleÚ	showscaleÚreversescaleÚ é   Útopzrgb(0, 0, 0))ÚticksÚdtickÚsideÚ	gridcolorz  )r!   r"   Ú
ticksuffix)ÚannotationsÚxaxisÚyaxis)r   r   r   r   r   F)r!   r#   r$   Úshowticklabels)r!   r%   r)   )ÚdataÚlayout© )r   r   Úvalidate_coerceÚ_AnnotatedHeatmapÚmake_annotationsÚdictr   ÚFigure)r   r   r   r   r   Úfont_colorsr   r   ÚkwargsÚcolorscale_validatorr&   Útracer+   r*   s                 r   Úcreate_annotated_heatmapr6   0   s9  € ðj "-Ð!8‘+¸b€KÜ˜q ! Q¨Ô8ô /Ó0ÐØ%×5Ñ5°jÓA€Jä#Ø	ˆ1ˆa� *¨k¸<ñØKQñçÑÓð ñ 	‰AÜð 	
ØØØØØ!ØØ%ñ	
ð ñ	
ˆô Ø#Ü˜R q¨uÀÔOÜ˜R q°TÔ:ô
‰ô ð 
ØØØ!ØØ%ñ
ð ñ
ˆô Ø#ÜØ˜u°Èuôô ˜R¨DÀÔGô
ˆð ˆ7€Dä×Ñ $¨vÔ6Ð6r   c                 ó  — | j                  «       } | j                  d«      r7| j                  d«      j                  d«      D �cg c]  }t        |«      ‘Œ c}S | j                  d«      rt	        j
                  | «      S |S c c}w )NÚrgbzrgba()ú,ú#)ÚstripÚ
startswithÚsplitÚintÚclrsÚ
hex_to_rgb)Ú	color_strÚdefaultÚvs      r   Úto_rgb_color_listrD   –   sm   € Ø—‘Ó!€IØ×Ñ˜EÔ"Ø )§¡°Ó 9× ?Ñ ?ÀÓ DÖE˜1”�A•ÒEÐEØ	×	Ñ	˜cÔ	"Ü�‰˜yÓ)Ð)àˆùò	 Fs   ÁBc                 ó<   — | d   dz  | d   dz  z   | d   dz  z   dkD  S )Nr   g‰A`åÐ"Ó?r   gbX9´Èâ?é   gÉv¾Ÿ/½?éº   r,   )Úbackground_colors    r   Úshould_use_black_textrI       sB   € à˜Ñ˜eÑ#Ø
˜1Ñ
 Ñ
%ñ	&à
˜1Ñ
 Ñ
%ñ	&ð 	ñ	ð r   c                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)r.   zH
    Refer to TraceFactory.create_annotated_heatmap() for docstring
    c                 ó²  — || _         |r|| _        nt        t        |d   «      «      | _        |r|| _        nt        t        |«      «      | _        |�|| _        n| j                   | _        || _        || _        || _        t        rmt        | j                   t        j                  «      rIt        j                  | j                   «      | _        t        j                  | j                   «      | _        nbt!        | j                   D �	�
cg c]  }	|	D ]  }
|
‘Œ Œ c}
}	«      | _        t#        | j                   D �	�
cg c]  }	|	D ]  }
|
‘Œ Œ c}
}	«      | _        |j%                  dd «      �
|d   | _        |j%                  dd «      �
|d   | _        | j                  | j                  z   dz  | _        |j%                  dd «      �|d   | _        y y c c}
}	w c c}
}	w )Nr   ÚzminÚzmaxrF   Úzmid)r   r   r   r   r   r   r   r   r2   Únpr
   ÚndarrayÚaminrL   ÚamaxrM   ÚminÚmaxÚgetrN   )Úselfr   r   r   r   r   r2   r   r3   ÚrowrC   s              r   Ú__init__z_AnnotatedHeatmap.__init__­   su  € ð ˆŒÙØˆD�Fäœ3˜q ™t›9Ó%ˆDŒFÙØˆD�Fäœ3˜q›6“]ˆDŒFØÐ&Ø#2ˆDÕ à#'§6¡6ˆDÔ Ø$ˆŒØ(ˆÔØ&ˆÔå”*˜TŸV™V¤R§Z¡ZÔ0ÜŸ™ §¡›ˆDŒIÜŸ™ §¡›ˆD�Iä¨$¯&©&×> 3¸#Ò>°QšQÐ>˜QÓ>Ó?ˆDŒIÜ¨$¯&©&×> 3¸#Ò>°QšQÐ>˜QÓ>Ó?ˆDŒIà�:‰:�f˜dÓ#Ð/Ø˜v™ˆDŒIØ�:‰:�f˜dÓ#Ð/Ø˜v™ˆDŒIà—Y‘Y §¡Ñ*¨aÑ/ˆŒ	à�:‰:�f˜dÓ#Ð/Ø˜v™ˆD�Ið 0ùó ?ùÛ>s   ÄG
Ä9G
c                 ó~  — g d¢}dg}d}d}| j                   r"| j                   d   }| j                   d   }||fS | j                  |v r| j                  r|}|}||fS | j                  |v r|}|}||fS | j                  |v r| j                  r|}|}||fS | j                  |v r|}|}||fS t        | j                  t        «      rst        | j                  d   d   g d¢«      }t        | j                  d   d   g d¢«      }| j                  r||}}t        |«      r|}n|}t        |«      r|}||fS |}||fS |}|}||fS )	a•  
        Get font color for annotations.

        The annotated heatmap can feature two text colors: min_text_color and
        max_text_color. The min_text_color is applied to annotations for
        heatmap values < (max_value - min_value)/2. The user can define these
        two colors. Otherwise the colors are defined logically as black or
        white depending on the heatmap's colorscale.

        :rtype (string, string) min_text_color, max_text_color: text
            color for annotations for heatmap values <
            (max_value - min_value)/2 and text color for annotations for
            heatmap values >= (max_value - min_value)/2
        )ÚGreysÚGreensÚBluesÚYIGnBuÚYIOrRdÚRdBuÚPicnicÚJetÚHotÚ	BlackbodyÚEarthÚElectricÚViridisÚCividisÚRedsz#FFFFFFz#000000r   éÿÿÿÿr   )éÿ   rj   rj   )r2   r   r   r
   r   rD   rI   )	rV   ÚcolorscalesÚcolorscales_reverseÚwhiteÚblackÚmin_text_colorÚmax_text_colorÚmin_colÚmax_cols	            r   Úget_text_colorz _AnnotatedHeatmap.get_text_colorÓ   sª  € ò 
ˆð"  &˜hÐàˆØˆØ×ÒØ!×-Ñ-¨aÑ0ˆNØ!×-Ñ-¨bÑ1ˆNðD ˜~Ð-Ð-ðC �_‰_ Ñ+°×0AÒ0AØ"ˆNØ"ˆNð> ˜~Ð-Ð-ð= �_‰_ Ñ+Ø"ˆNØ"ˆNð8 ˜~Ð-Ð-ð7 �_‰_Ð 3Ñ3¸×8IÒ8IØ"ˆNØ"ˆNð2 ˜~Ð-Ð-ð1 �_‰_Ð 3Ñ3Ø"ˆNØ"ˆNð, ˜~Ð-Ð-ô+ ˜Ÿ™¬Ô.ä'¨¯©¸Ñ(:¸1Ñ(=ºÓOˆGÜ'¨¯©¸Ñ(;¸AÑ(>ÂÓPˆGð × Ò Ø#*¨G˜�ä$ WÔ-Ø!&‘à!&�ä$ WÔ-Ø!&�ð ˜~Ð-Ð-ð	 "'�ð ˜~Ð-Ð-ð #ˆNØ"ˆNØ˜~Ð-Ð-r   c                 ó¤  — t         j                  | «      \  }}g }t        | j                  «      D ]�  \  }}t        |«      D ]Š  \  }}|| j                  k  r|n|}|j                  t        j                  j                  t        | j                  |   |   «      | j                  |   | j                  |   ddt        |¬«      d¬«      «       ŒŒ ŒŸ |S )zÀ
        Get annotations for each cell of the heatmap with graph_objs.Annotation

        :rtype (list[dict]) annotations: list of annotations for each cell of
            the heatmap
        Úx1Úy1)ÚcolorF)Útextr   r   ÚxrefÚyrefÚfontÚ	showarrow)r.   rs   Ú	enumerater   rN   Úappendr   r+   Ú
AnnotationÚstrr   r   r   r0   )	rV   ro   rp   r&   ÚnrW   ÚmÚvalÚ
font_colors	            r   r/   z"_AnnotatedHeatmap.make_annotations  sÐ   € ô *;×)IÑ)IÈ$Ó)OÑ&ˆ˜ØˆÜ §¡Ó'ò 	‰FˆAˆsÜ# C›.ò ‘��3Ø/2°T·Y±Yª™^ÀN�
Ø×"Ñ"Ü×%Ñ%×0Ñ0Ü  ×!5Ñ!5°aÑ!8¸Ñ!;Ó<ØŸ&™& ™)ØŸ&™& ™)Ø!Ø!Ü!¨
Ô3Ø"'ð 1ó õ
ñð	ð Ðr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rX   rs   r/   r,   r   r   r.   r.   ¨   s   „ ñò$'òLI.óVr   r.   )NNNÚPlasmaNFF)Úplotly.colorsÚcolorsr?   Úplotlyr   r   Úplotly.figure_factoryr   Úplotly.graph_objsr   Úplotly.validators.heatmapr   Ú
get_modulerO   r   r6   rD   rI   Úobjectr.   r,   r   r   ú<module>r’      se   ðÝ ß /Ý 'Ý (Ý 9ð !Ð× Ñ  Ó)€ò"ðN Ø
ØØØØØóc7òLòôM˜õ Mr   