§
    õŽ’jKˆ  ã                   óh  — d Z ddlZddlZddlmZ ddlmZmZmZm	Z	m
Z
 ddlZej        j                             d¬¦  «          G d„ d¦  «        Z G d	„ d
¦  «        Z G d„ de¦  «        Zej        j                             dddddd¬¦  «          G d„ dee	j        ¦  «        Zd„ Zdd„Zdd„Zd„ ZdS )aN  
The Colorizer class which handles the data to color pipeline via a
normalization and a colormap.

.. admonition:: Provisional status of colorizer

    The ``colorizer`` module and classes in this file are considered
    provisional and may change at any time without a deprecation period.

.. seealso::

  :doc:`/gallery/color/colormap_reference` for a list of builtin colormaps.

  :ref:`colormap-manipulation` for examples of how to make colormaps.

  :ref:`colormaps` for an in-depth discussion of choosing colormaps.

  :ref:`colormapnorms` for more details about data normalization.

é    N)Úma)Ú_apiÚcolorsÚcbookÚartistÚscalez½colorizer : `~matplotlib.colorizer.Colorizer` or None, default: None
    The Colorizer object used to map color to data. If None, a Colorizer
    object is created from a *norm* and *cmap*.)Úcolorizer_docc                   ót  — e Zd ZdZdd„Zd„ Zed„ ¦   «         Zej        d„ ¦   «         Zdd	„Z	e
dd
„¦   «         Zd„ Zd„ Zd„ Zed„ ¦   «         Zej        d„ ¦   «         Zdd„Zd„ Zd„ Zed„ ¦   «         Zej        d„ ¦   «         Zed„ ¦   «         Zej        d„ ¦   «         Zed„ ¦   «         Zej        d„ ¦   «         ZdS )Ú	Colorizera™  
    Data to color pipeline.

    This pipeline is accessible via `.Colorizer.to_rgba` and executed via
    the `.Colorizer.norm` and `.Colorizer.cmap` attributes.

    Parameters
    ----------
    cmap: colorbar.Colorbar or str or None, default: None
        The colormap used to color data.

    norm: colors.Normalize or str or None, default: None
        The normalization used to normalize the data
    Nc                 ó¬   — d | _         |                      |¦  «         d | _        d | _        || _        t          j        dg¬¦  «        | _        d | _        d S )NÚchanged©Úsignals)	Ú_cmapÚ	_set_cmapÚ_id_normÚ_normÚnormr   ÚCallbackRegistryÚ	callbacksÚcolorbar)ÚselfÚcmapr   s      úBC:\Projects\DSCons\.venv\Lib\site-packages\matplotlib\colorizer.pyÚ__init__zColorizer.__init__5   sR   € àˆŒ
Ø�Š�tÑÔÐàˆŒØˆŒ
ØˆŒ	åÔ/¸¸ÐDÑDÔDˆŒØˆŒˆˆó    c                 ó¶   — |€|�?|                       ||¦  «         t          |t          j        ¦  «        rt	          d¦  «        ‚|                      |¦  «         dS )a,  
        Helper for initial scaling.

        Used by public functions that create a ScalarMappable and support
        parameters *vmin*, *vmax* and *norm*. This makes sure that a *norm*
        will take precedence over *vmin*, *vmax*.

        Note that this method does not set the norm.
        Nz”Passing a Normalize instance simultaneously with vmin/vmax is not supported.  Please pass vmin/vmax as arguments to the norm object when creating it)Úset_climÚ
isinstancer   Ú	NormalizeÚ
ValueErrorÚautoscale_None)r   r   ÚvminÚvmaxÚAs        r   Ú_scale_normzColorizer._scale_normA   sp   € ð Ð˜tÐ/Ø�MŠM˜$ Ñ%Ô%Ð%Ý˜$¥Ô 0Ñ1Ô1ð HÝ ðGñHô Hð Hð 	×Ò˜AÑÔÐÐÐr   c                 ó   — | j         S ©N)r   ©r   s    r   r   zColorizer.normW   ó
   € àŒzÐr   c                 óB  — t          || j        j        ¬¦  «        }|| j        u rd S | j        d u }|s$| j        j                             | j        ¦  «         || _        | j        j                             d| j	        ¦  «        | _        |s|  	                    ¦   «          d S d S )N)Ún_componentsr   )
Ú_ensure_normr   Ú
n_variatesr   r   Ú
disconnectr   r   Úconnectr   )r   r   Úin_inits      r   r   zColorizer.norm[   s©   € å˜D¨t¬yÔ/CÐDÑDÔDˆØ�4”9ÐÐàˆFà”)˜tÐ#ˆàð 	:ØŒIÔ×*Ò*¨4¬=Ñ9Ô9Ð9ØˆŒ
Øœ	Ô+×3Ò3°IØ48´LñBô BˆŒàð 	Ø�LŠL‰NŒNˆNˆNˆNð	ð 	r   FTc                 ó  — t          |t          j        ¦  «        r#|j        dk    r|                      ||||¦  «        S t          j        |¦  «        }|r|                      |¦  «        }|                      |||¬¦  «        }|S )áÂ  
        Return a normalized RGBA array corresponding to *x*.

        In the normal case, *x* is a 1D or 2D sequence of scalars, and
        the corresponding `~numpy.ndarray` of RGBA values will be returned,
        based on the norm and colormap set for this Colorizer.

        There is one special case, for handling images that are already
        RGB or RGBA, such as might have been read from an image file.
        If *x* is an `~numpy.ndarray` with 3 dimensions,
        and the last dimension is either 3 or 4, then it will be
        treated as an RGB or RGBA array, and no mapping will be done.
        The array can be `~numpy.uint8`, or it can be floats with
        values in the 0-1 range; otherwise a ValueError will be raised.
        Any NaNs or masked elements will be set to 0 alpha.
        If the last dimension is 3, the *alpha* kwarg (defaulting to 1)
        will be used to fill in the transparency.  If the last dimension
        is 4, the *alpha* kwarg is ignored; it does not
        replace the preexisting alpha.  A ValueError will be raised
        if the third dimension is other than 3 or 4.

        In either case, if *bytes* is *False* (default), the RGBA
        array will be floats in the 0-1 range; if it is *True*,
        the returned RGBA array will be `~numpy.uint8` in the 0 to 255 range.

        If norm is False, no normalization of the input data is
        performed, and it is assumed to be in the range (0-1).

        é   )ÚalphaÚbytes)	r   ÚnpÚndarrayÚndimÚ_pass_image_datar   Úasarrayr   r   )r   Úxr5   r6   r   Úrgbas         r   Úto_rgbazColorizer.to_rgbal   s   € õ> �a�œÑ$Ô$ð 	@¨¬°1ª¨Ø×(Ò(¨¨E°5¸$Ñ?Ô?Ð?õ ŒJ�q‰MŒMˆØð 	Ø—	’	˜!‘”ˆAØ�yŠy˜ %¨uˆyÑ5Ô5ˆØˆr   c                 ót  — | j         d         dk    r{|€d}| j        t          j        k    rt          j        |dz  ¦  «        }| j         dd…         \  }}t          j        ||df| j        ¬¦  «        }| |dd…dd…dd…f<   ||dd…dd…df<   n#| j         d         dk    r| }nt          d¦  «        ‚|j        j        d	k    rÐt          j        t          j        | ¦  «        x}¦  «        rB| j         d         dk    r| 	                    ¦   «         }d
|t          j        |d¬¦  «        dd…f<   |r?| 
                    ¦   «         dk    s|                     ¦   «         d
k     rt          d¦  «        ‚|r"|dz                       t          j        ¦  «        }nQ|j        t          j        k    r%|s"|                     t          j        ¦  «        dz  }nt          d|j        z  ¦  «        ‚t          j                             | ¦  «        r8d
|t          j        t          j                             | ¦  «        d¬¦  «        df<   |S )zŠ
        Helper function to pass ndarray of shape (...,3) or (..., 4)
        through `to_rgba()`, see `to_rgba()` for docstring.
        é   r4   Né   éÿ   é   )ÚshapeÚdtypezThird dimension must be 3 or 4Úfr   )Úaxisz:Floating point image RGB values must be in the [0,1] rangez9Image RGB array must be uint8 or floating point; found %s)rD   rE   r7   Úuint8Úemptyr!   ÚkindÚanyÚisnanÚcopyÚmaxÚminÚastypeÚfloat32r   Ú	is_maskedÚgetmaskarray)r<   r5   r6   r   ÚmÚnÚxxÚnanss           r   r:   zColorizer._pass_image_data•   s4  € ð Œ7�1Œ:˜Š?ˆ?Øˆ}Ø�ØŒw�"œ(Ò"Ð"Ýœ ¨¡Ñ-Ô-�Ø”7˜2˜A˜2”;‰DˆAˆqÝ”  A q 	°´Ð9Ñ9Ô9ˆBØˆBˆqˆqˆq�!�!�!�R�a�Rˆx‰LØˆBˆqˆqˆq�!�!�!�Qˆw‰KˆKØŒW�QŒZ˜1Š_ˆ_ØˆBˆBåÐ=Ñ>Ô>Ð>ØŒ8Œ=˜CÒÐåŒv�bœh q™kœkÐ)�dÑ*Ô*ð 0Ø”7˜1”: ’?�?ØŸš™œ�BØ./�•2”6˜$ QÐ'Ñ'Ô'¨¨¨Ð*Ñ+àð ?˜Ÿš™œ Aš˜¨¯ª©¬°Aª¨Ý ð ">ñ ?ô ?ð ?àð 1Ø˜3‘h×&Ò&¥r¤xÑ0Ô0�øØŒX�œÒ!Ð!Øð 1Ø—Y’Y�rœzÑ*Ô*¨SÑ0�øåð 8Ø:<¼(ñCñ Dô Dð Dõ Œ5�?Š?˜1ÑÔð 	=Ø;<ˆB�rŒv•b”e×(Ò(¨Ñ+Ô+°!Ð4Ñ4Ô4°aÐ7Ñ8Øˆ	r   c                 ó\   — |€t          d¦  «        ‚| j                             |¦  «         dS )úb
        Autoscale the scalar limits on the norm instance using the
        current array
        Nú%You must first set_array for mappable)Ú	TypeErrorr   Ú	autoscale©r   r%   s     r   r\   zColorizer.autoscaleÀ   s6   € ð
 ˆ9ÝÐCÑDÔDÐDð 	Œ	×Ò˜AÑÔÐÐÐr   c                 ó\   — |€t          d¦  «        ‚| j                             |¦  «         dS )ú†
        Autoscale the scalar limits on the norm instance using the
        current array, changing only limits that are None
        NrZ   )r[   r   r"   r]   s     r   r"   zColorizer.autoscale_NoneË   s6   € ð
 ˆ9ÝÐCÑDÔDÐDð 	Œ	× Ò  Ñ#Ô#Ð#Ð#Ð#r   c           
      ó  — | j         du }t          |d¬¦  «        }|sJ| j        j        |j        k    r5t          d|› d| j        j        › dt          | j        ¦  «        › d�¦  «        ‚|| _         |s|                      ¦   «          dS dS )ú‡
        Set the colormap for luminance data.

        Parameters
        ----------
        cmap : `.Colormap` or str or None
        NT)Úaccept_multivariatezThe colormap z does not support z variates as required by the z on this Colorizer)r   Ú_ensure_cmapr   r,   r.   r!   Útyper   )r   r   r1   Úcmap_objs       r   r   zColorizer._set_cmapÖ   sÃ   € ð ”* Ð$ˆÝ ¸$Ð?Ñ?Ô?ˆØð 	I˜4œ9Ô1°XÔ5HÒHÐHÝð H¨Tð Hð HØ $¤	Ô 6ðHð Hå$(¨¬¡O¤OðHð Hð Hñ Iô Ið Ið ˆŒ
Øð 	Ø�LŠL‰NŒNˆNˆNˆNð	ð 	r   c                 ó   — | j         S r(   )r   r)   s    r   r   zColorizer.cmapè   r*   r   c                 ó0   — |                       |¦  «         d S r(   )r   ©r   r   s     r   r   zColorizer.cmapì   s   € à�Š�tÑÔÐÐÐr   c                 ó¸  — | j         j        dk    r |€	 |\  }}n# t          t          f$ r Y nw xY w| j         j        | j         j        f}| j         j                             d¬¦  «        5  |�|| j         _        |�|| j         _        ddd¦  «         n# 1 swxY w Y   || j         j        | j         j        fk    r!| j         j                             d¦  «         dS dS )aJ  
        Set the norm limits for image scaling.

        Parameters
        ----------
        vmin, vmax : float
             The limits.

             For scalar data, the limits may also be passed as a
             tuple (*vmin*, *vmax*) single positional argument.

             .. ACCEPTS: (vmin: float, vmax: float)
        rA   Nr   )Úsignal)	r   r,   r[   r!   r#   r$   r   ÚblockedÚprocess)r   r#   r$   Úorig_vmin_vmaxs       r   r   zColorizer.set_climð   s6  € ð Œ9Ô! QÒ&Ð&Øˆ|ðØ!%‘J�D˜$˜$øÝ!¥:Ð.ð ð ð Ø�Dðøøøð œœ¨¬¬Ð7ˆð ŒYÔ ×(Ò(°	Ð(Ñ:Ô:ð 	&ð 	&ð ÐØ!%�”	”ØÐØ!%�”	”ð	&ð 	&ð 	&ñ 	&ô 	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&øøøð 	&ð 	&ð 	&ð 	&ð ˜dœiœn¨d¬i¬nÐ=Ò=Ð=ØŒIÔ×'Ò'¨	Ñ2Ô2Ð2Ð2Ð2ð >Ð=s   ” š.­.Á)BÂBÂBc                 ó2   — | j         j        | j         j        fS ©zV
        Return the values (min, max) that are mapped to the colormap limits.
        )r   r#   r$   r)   s    r   Úget_climzColorizer.get_clim  s   € ð ŒyŒ~˜tœyœ~Ð-Ð-r   c                 óH   — | j                              d¦  «         d| _        dS ©z„
        Call this whenever the mappable is changed to notify all the
        callbackSM listeners to the 'changed' signal.
        r   TN©r   rl   Ústaler)   s    r   r   zColorizer.changed  s%   € ð
 	Œ×Ò˜yÑ)Ô)Ð)ØˆŒ
ˆ
ˆ
r   c                 ó6   — |                       ¦   «         d         S )Nr   ©rp   r)   s    r   r#   zColorizer.vmin#  ó   € à�}Š}‰Œ˜qÔ!Ð!r   c                 ó2   — |                       |¬¦  «         d S )N)r#   ©r   )r   r#   s     r   r#   zColorizer.vmin'  ó   € à�Š˜4ˆÑ Ô Ð Ð Ð r   c                 ó6   — |                       ¦   «         d         S ©NrA   rv   r)   s    r   r$   zColorizer.vmax+  rw   r   c                 ó2   — |                       |¬¦  «         d S )N)r$   ry   )r   r$   s     r   r$   zColorizer.vmax/  rz   r   c                 ó   — | j         j        S r(   ©r   Úclipr)   s    r   r€   zColorizer.clip3  s   € àŒyŒ~Ðr   c                 ó   — || j         _        d S r(   r   )r   r€   s     r   r€   zColorizer.clip7  s   € àˆŒ	Œˆˆr   ©NN©NFT)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r&   Úpropertyr   Úsetterr>   Ústaticmethodr:   r\   r"   r   r   r   rp   r   r#   r$   r€   © r   r   r   r   &   sï  € € € € € ðð ð
ð 
ð 
ð 
ðð ð ð, ðð ñ „Xðð 
„[ðð ñ „[ðð 'ð 'ð 'ð 'ðR ð(ð (ð (ñ „\ð(ðT	ð 	ð 	ð	$ð 	$ð 	$ðð ð ð$ ðð ñ „Xðð 
„[ðð ñ „[ðð#3ð #3ð #3ð #3ðJ.ð .ð .ðð ð ð ð"ð "ñ „Xð"ð 
„[ð!ð !ñ „[ð!ð ð"ð "ñ „Xð"ð 
„[ð!ð !ñ „[ð!ð ðð ñ „Xðð 
„[ðð ñ „[ðð ð r   r   c                   ó  ‡ — e Zd ZdZd„ Zdd„Zd„ Zdd„Zˆ fd	„Ze	d
„ ¦   «         Z
e
j        d„ ¦   «         Z
d„ Zd„ Ze	d„ ¦   «         Zej        d„ ¦   «         Zd„ Zd„ Zd„ Ze	d„ ¦   «         Zej        d„ ¦   «         Zd„ Zed„ ¦   «         Zˆ xZS )Ú_ColorizerInterfaceaB  
    Base class that contains the interface to `Colorizer` objects from
    a `ColorizingArtist` or `.cm.ScalarMappable`.

    Note: This class only contain functions that interface the .colorizer
    attribute. Other functions that as shared between `.ColorizingArtist`
    and `.cm.ScalarMappable` are not included.
    c                 óJ   — | j                              |||| j        ¦  «         d S r(   )Ú
_colorizerr&   Ú_A)r   r   r#   r$   s       r   r&   z_ColorizerInterface._scale_normE  s&   € ØŒ×#Ò# D¨$°°d´gÑ>Ô>Ð>Ð>Ð>r   NFTc                 ó>   — | j                              ||||¬¦  «        S )r3   )r5   r6   r   )r�   r>   )r   r<   r5   r6   r   s        r   r>   z_ColorizerInterface.to_rgbaH  s#   € ð< Œ×&Ò& q°¸UÈÐ&ÑNÔNÐNr   c                 ó4   — | j                              ¦   «         S ro   )r�   rp   r)   s    r   rp   z_ColorizerInterface.get_climh  s   € ð Œ×'Ò'Ñ)Ô)Ð)r   c                 ó<   — | j                              ||¦  «         dS )aO  
        Set the norm limits for image scaling.

        Parameters
        ----------
        vmin, vmax : float
             The limits.

             For scalar data, the limits may also be passed as a
             tuple (*vmin*, *vmax*) as a single positional argument.

             .. ACCEPTS: (vmin: float, vmax: float)
        N)r�   r   )r   r#   r$   s      r   r   z_ColorizerInterface.set_climn  s"   € ð  	Œ× Ò   tÑ,Ô,Ð,Ð,Ð,r   c                 óh   •— 	 t          ¦   «                              ¦   «         S # t          $ r Y dS w xY wr|   )ÚsuperÚ	get_alphaÚAttributeError)r   Ú	__class__s    €r   r–   z_ColorizerInterface.get_alpha€  s@   ø€ ð	Ý‘7”7×$Ò$Ñ&Ô&Ð&øÝð 	ð 	ð 	Ø�1�1ð	øøøs   ƒ# £
1°1c                 ó   — | j         j        S r(   ©r�   r   r)   s    r   r   z_ColorizerInterface.cmap†  ó   € àŒÔ#Ð#r   c                 ó   — || j         _        d S r(   rš   rh   s     r   r   z_ColorizerInterface.cmapŠ  ó   € à#ˆŒÔÐÐr   c                 ó   — | j         j        S )z Return the `.Colormap` instance.rš   r)   s    r   Úget_cmapz_ColorizerInterface.get_cmapŽ  r›   r   c                 ó   — || _         dS )ra   N)r   rh   s     r   Úset_cmapz_ColorizerInterface.set_cmap’  s   € ð ˆŒ	ˆ	ˆ	r   c                 ó   — | j         j        S r(   ©r�   r   r)   s    r   r   z_ColorizerInterface.normœ  r›   r   c                 ó   — || j         _        d S r(   r£   ©r   r   s     r   r   z_ColorizerInterface.norm   r�   r   c                 ó   — || _         dS )a_  
        Set the normalization instance.

        Parameters
        ----------
        norm : `.Normalize` or str or None

        Notes
        -----
        If there are any colorbars using the mappable for this norm, setting
        the norm of the mappable will reset the norm, locator, and formatters
        on the colorbar to default.
        N©r   r¥   s     r   Úset_normz_ColorizerInterface.set_norm¤  s   € ð ˆŒ	ˆ	ˆ	r   c                 óD   — | j                              | j        ¦  «         dS )rY   N)r�   r\   r�   r)   s    r   r\   z_ColorizerInterface.autoscale´  s"   € ð
 	Œ×!Ò! $¤'Ñ*Ô*Ð*Ð*Ð*r   c                 óD   — | j                              | j        ¦  «         dS )r_   N)r�   r"   r�   r)   s    r   r"   z"_ColorizerInterface.autoscale_None»  s"   € ð
 	Œ×&Ò& t¤wÑ/Ô/Ð/Ð/Ð/r   c                 ó   — | j         j        S )zL
        The last colorbar associated with this object. May be None
        ©r�   r   r)   s    r   r   z_ColorizerInterface.colorbarÂ  s   € ð
 ŒÔ'Ð'r   c                 ó   — || j         _        d S r(   r¬   )r   r   s     r   r   z_ColorizerInterface.colorbarÉ  s   € à#+ˆŒÔ Ð Ð r   c                 óÐ  ‡ — t           j                             |¦  «        s|€dS t          ‰ j        t
          j        ¦  «        rV‰ j        j        }t          ‰ j        t
          j	        ¦  «        r‰ j        j
        ‰ j        j        f}n*d„ ‰ j        D ¦   «         }n‰ j        g}|g}‰ j        j
        g}ˆ fd„t          |||¦  «        D ¦   «         }dd                     |¦  «        › d�S )Nz[]c                 ó   — g | ]	}|j         ‘Œ
S r‹   )ÚN©Ú.0Úparts     r   ú
<listcomp>zD_ColorizerInterface._format_cursor_data_override.<locals>.<listcomp>à  s   € Ð4Ð4Ð4 $�t”vÐ4Ð4Ð4r   c           	      óR   •— g | ]#\  }}}|d ‰                      |||¦  «        › d�›‘Œ$S )z-#.Úg)Ú_sig_digits_from_norm)r²   ÚnoÚdrU   r   s       €r   r´   zD_ColorizerInterface._format_cursor_data_override.<locals>.<listcomp>æ  sR   ø€ ð 5ð 5ð 5Ù�"�a˜ð Ð?�t×1Ò1°"°a¸Ñ;Ô;Ð?Ð?Ð?Ð?ð 5ð 5ð 5r   Ú[ú, Ú])r7   r   Úgetmaskr   r   r   Ú	MultiNormÚnormsr   ÚBivarColormapr°   ÚMÚzipÚjoin)r   Údatar¿   Ún_sÚoss   `    r   Ú_format_cursor_data_overridez0_ColorizerInterface._format_cursor_data_overrideÍ  sò   ø€ õ Œ5�=Š=˜ÑÔð 	 $ ,ð �4å�d”i¥Ô!1Ñ2Ô2ð 		 Ø”I”OˆEÝ˜$œ)¥VÔ%9Ñ:Ô:ð 5Ø”y”{ D¤I¤KÐ0��à4Ð4¨$¬)Ð4Ñ4Ô4��à”Y�KˆEØ�6ˆDØ”9”;�-ˆCð5ð 5ð 5ð 5Ý! %¨¨sÑ3Ô3ð5ñ 5ô 5ˆà#�4—9’9˜R‘=”=Ð#Ð#Ð#Ð#r   c                 óÔ  —  | |¦  «        }t          j        |¦  «        �rEt          | t          j        ¦  «        rxt          j        t          j        | j        |z
  ¦  «        ¦  «        }t          d|dz
  ¦  «        }t          j	        | j        ||dz   …         ¦  «                             ¦   «         }n�| j
        | j        k    rt          j        | j
        dz  ¦  «        }np|                      t          t          |¦  «        |z  ¦  «        t          j        ddg¦  «        z   |z  ¦  «        }t          ||z
  ¦  «                             ¦   «         }t!          j        ||¦  «        }nd}|S )Nr   rA   r@   gš™™™™™¹?r4   )r7   Úisfiniter   r   ÚBoundaryNormÚargminÚabsÚ
boundariesrN   Údiffr#   r$   ÚinverseÚintÚfloatÚarrayr   Ú_g_sig_digits)	r   rÄ   rU   ÚnormedÚcur_idxÚ	neigh_idxÚdeltaÚ	neighborsÚg_sig_digitss	            r   r·   z)_ColorizerInterface._sig_digits_from_normê  s@  € ð
 ��d‘”ˆÝŒ;�vÑÔñ 	Ý˜$¥Ô 3Ñ4Ô4ð 4åœ)¥B¤F¨4¬?¸TÑ+AÑ$BÔ$BÑCÔC�Ý  7¨Q¡;Ñ/Ô/�	åœ ¤°	¸'ÀA¹+Ð0EÔ FÑGÔG×KÒKÑMÔM��Ø”˜dœiÒ'Ð'åœ˜tœy¨2™~Ñ.Ô.��ð !ŸLšLÝ�˜v™œ¨Ñ*Ñ+Ô+­b¬h¸¸1°vÑ.>Ô.>Ñ>À!ÑCñEô E�	å˜I¨Ñ,Ñ-Ô-×1Ò1Ñ3Ô3�å Ô.¨t°UÑ;Ô;ˆLˆLàˆLØÐr   rƒ   r‚   )r„   r…   r†   r‡   r&   r>   rp   r   r–   rˆ   r   r‰   rŸ   r¡   r   r¨   r\   r"   r   rÇ   rŠ   r·   Ú__classcell__©r˜   s   @r   r�   r�   <  sª  ø€ € € € € ðð ð?ð ?ð ?ðOð Oð Oð Oð@*ð *ð *ð-ð -ð -ð -ð$ð ð ð ð ð ð$ð $ñ „Xð$ð 
„[ð$ð $ñ „[ð$ð$ð $ð $ðð ð ð ð$ð $ñ „Xð$ð 
„[ð$ð $ñ „[ð$ðð ð ð +ð +ð +ð0ð 0ð 0ð ð(ð (ñ „Xð(ð „_ð,ð ,ñ „_ð,ð$ð $ð $ð: ðð ñ „\ðð ð ð ð r   r�   c                   óh   ‡ — e Zd ZdZd
ddœˆ fd„Zd„ Zd„ Zd„ Zed„ ¦   «         Z	ed	„ ¦   «         Z
ˆ xZS )Ú_ScalarMappablezÍ
    A mixin class to map one or multiple sets of scalar data to RGBA.

    The ScalarMappable applies data normalization before returning RGBA colors from
    the given `~matplotlib.colors.Colormap`.
    N©Ú	colorizerc                ó  •—  t          ¦   «         j        di |¤Ž d| _        |                      |||¬¦  «        | _        d| _        | j        j                             d| j        ¦  «        | _	        t          j        dg¬¦  «        | _        dS )ar  
        Parameters
        ----------
        norm : `.Normalize` (or subclass thereof) or str or None
            The normalizing object which scales data, typically into the
            interval ``[0, 1]``.
            If a `str`, a `.Normalize` subclass is dynamically generated based
            on the scale with the corresponding name.
            If *None*, *norm* defaults to a *colors.Normalize* object which
            initializes its scaling based on the first data processed.
        cmap : str or `~matplotlib.colors.Colormap`
            The colormap used to map normalized data values to RGBA colors.
        N)rß   r   r   r   r   r‹   )r•   r   r�   Ú_get_colorizerr�   r   r   r0   r   Ú_id_colorizerr   r   )r   r   r   rß   Úkwargsr˜   s        €r   r   z_ScalarMappable.__init__  s‡   ø€ ð 	�‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"ØˆŒØ×-Ò-¸	ÈÐSWÐ-ÑXÔXˆŒàˆŒØ!œ_Ô6×>Ò>¸yÈ$Ì,ÑWÔWˆÔÝÔ/¸¸ÐDÑDÔDˆŒˆˆr   c                 ó  — |€	d| _         dS t          || j        j        ¦  «        }t	          j        |d¬¦  «        }t          j        |j        t          d¦  «        sq|j        j
        €t          d|j        › d�¦  «        ‚|j        j
        D ]@}t          j        ||         j        t          d¦  «        st          d|j        › d�¦  «        ‚ŒA|| _         | j                             ¦   «         s| j                             |¦  «         dS dS )aB  
        Set the value array from array-like *A*.

        Parameters
        ----------
        A : array-like or None
            The values that are mapped to colors.

            The base class `.ScalarMappable` does not make any assumptions on
            the dimensionality and shape of the value array *A*.
        NT©rM   Ú	same_kindzImage data of dtype z cannot be converted to floatz, cannot be converted to a sequence of floats)r�   Ú_ensure_multivariate_datar   r,   r   Úsafe_masked_invalidr7   Úcan_castrE   rÑ   Úfieldsr[   Úscaledr�   r"   )r   r%   Úkeys      r   Ú	set_arrayz_ScalarMappable.set_array2  s;  € ð ˆ9ØˆDŒGØˆFå% a¨¬Ô)?Ñ@Ô@ˆåÔ% a¨dÐ3Ñ3Ô3ˆÝŒ{˜1œ7¥E¨;Ñ7Ô7ð 		NØŒwŒ~Ð%åð !6°q´wð !6ð !6ð !6ñ 7ô 7ð 7ð œ7œ>ð Nð N�CÝœ; q¨¤v¤|µU¸KÑHÔHð NÝ'ð )M¸q¼wð )Mð )Mð )Mñ Nô Nð NðNð ˆŒØŒy×ÒÑ!Ô!ð 	.ØŒO×*Ò*¨1Ñ-Ô-Ð-Ð-Ð-ð	.ð 	.r   c                 ó   — | j         S )zÆ
        Return the array of values, that are mapped to colors.

        The base class `.ScalarMappable` does not make any assumptions on
        the dimensionality and shape of the array.
        )r�   r)   s    r   Ú	get_arrayz_ScalarMappable.get_arrayS  s   € ð Œwˆr   c                 óJ   — | j                              d| ¦  «         d| _        dS rr   rs   r)   s    r   r   z_ScalarMappable.changed\  s'   € ð
 	Œ×Ò˜y¨$Ñ/Ô/Ð/ØˆŒ
ˆ
ˆ
r   c                 óæ   — | �lt          d„ |                     ¦   «         D ¦   «         ¦  «        rCt          dd                     d„ |                     ¦   «         D ¦   «         ¦  «        z   ¦  «        ‚dS dS )zZ
        Raises a ValueError if any kwarg is not None while colorizer is not None
        Nc                 ó   — g | ]}|d u‘ŒS r(   r‹   )r²   Úvals     r   r´   z@_ScalarMappable._check_exclusionary_keywords.<locals>.<listcomp>j  s   € Ð?Ð?Ð?¨�C˜t�OÐ?Ð?Ð?r   zZThe `colorizer` keyword cannot be used simultaneously with any of the following keywords: r»   c              3   ó"   K  — | ]
}d |› d �V — ŒdS )ú`Nr‹   )r²   rì   s     r   ú	<genexpr>z?_ScalarMappable._check_exclusionary_keywords.<locals>.<genexpr>m  s*   è è € Ð,QÐ,Q¸C¨Z°¨Z¨Z¨ZÐ,QÐ,QÐ,QÐ,QÐ,QÐ,Qr   )rK   Úvaluesr!   rÃ   Úkeys)rß   rã   s     r   Ú_check_exclusionary_keywordsz,_ScalarMappable._check_exclusionary_keywordsd  s�   € ð
 Ð ÝÐ?Ð?¨v¯}ª}©¬Ð?Ñ?Ô?Ñ@Ô@ð SÝ ð "Ià#'§9¢9Ð,QÐ,QÀ6Ç;Â;Á=Ä=Ð,QÑ,QÔ,QÑ#QÔ#Qñ"Rñ Sô Sð Sð !Ð ðSð Sr   c                 ó”   — t          |t          ¦  «        r$t                               t          | |¬¦  «         |S t          | |¦  «        S )N)r   r   )r   r   rÝ   rù   )r   r   rß   s      r   rá   z_ScalarMappable._get_colorizero  sP   € å�i¥Ñ+Ô+ð 	Ý×8Ò8Ý ¨4ð 9ñ ô ð ð ÐÝ˜˜tÑ$Ô$Ð$r   r‚   )r„   r…   r†   r‡   r   rí   rï   r   rŠ   rù   rá   rÚ   rÛ   s   @r   rÝ   rÝ     sÂ   ø€ € € € € ðð ð*E¸$ð Eð Eð Eð Eð Eð Eð Eð,.ð .ð .ðBð ð ðð ð ð ðSð Sñ „\ðSð ð%ð %ñ „\ð%ð %ð %ð %ð %r   rÝ   z£cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
    The Colormap instance or registered colormap name used to map scalar data
    to colors.a“  cmap : str, `~matplotlib.colors.Colormap`, `~matplotlib.colors.BivarColormap`    or `~matplotlib.colors.MultivarColormap`, default: :rc:`image.cmap`
    The Colormap instance or registered colormap name used to map
    data values to colors.

    Multivariate data is only accepted if a multivariate colormap
    (`~matplotlib.colors.BivarColormap` or `~matplotlib.colors.MultivarColormap`)
    is used.aš  norm : str or `~matplotlib.colors.Normalize`, optional
    The normalization method used to scale scalar data to the [0, 1] range
    before mapping to colors using *cmap*. By default, a linear scaling is
    used, mapping the lowest value to 0 and the highest to 1.

    If given, this can be one of the following:

    - An instance of `.Normalize` or one of its subclasses
      (see :ref:`colormapnorms`).
    - A scale name, i.e. one of "linear", "log", "symlog", "logit", etc.  For a
      list of available scales, call `matplotlib.scale.get_scale_names()`.
      In that case, a suitable `.Normalize` subclass is dynamically generated
      and instantiated.at  norm : str, `~matplotlib.colors.Normalize` or list, optional
    The normalization method used to scale data to the [0, 1] range
    before mapping to colors using *cmap*. By default, a linear scaling is
    used, mapping the lowest value to 0 and the highest to 1.
    This can be one of the following:
    - An instance of `.Normalize` or one of its subclasses
      (see :ref:`colormapnorms`).
    - A scale name, i.e. one of "linear", "log", "symlog", "logit", etc.  For a
      list of available scales, call `matplotlib.scale.get_scale_names()`.
      In this case, a suitable `.Normalize` subclass is dynamically generated
      and instantiated.
    - A list of scale names or `.Normalize` objects matching the number of
      variates in the colormap, for use with `~matplotlib.colors.BivarColormap`
      or `~matplotlib.colors.MultivarColormap`, i.e. ``["linear", "log"]``.a  vmin, vmax : float, optional
    When using scalar data and no explicit *norm*, *vmin* and *vmax* define
    the data range that the colormap covers. By default, the colormap covers
    the complete value range of the supplied data. It is an error to use
    *vmin*/*vmax* when a *norm* instance is given (but using a `str` *norm*
    name together with *vmin*/*vmax* is acceptable).aH  vmin, vmax : float or list, optional
    When using scalar data and no explicit *norm*, *vmin* and *vmax* define
    the data range that the colormap covers. By default, the colormap covers
    the complete value range of the supplied data. It is an error to use
    *vmin*/*vmax* when a *norm* instance is given (but using a `str` *norm*
    name together with *vmin*/*vmax* is acceptable).

    A list of values (vmin or vmax) can be used to define independent limits
    for each variate when using a `~matplotlib.colors.BivarColormap` or
    `~matplotlib.colors.MultivarColormap`.)Úcmap_docÚmulti_cmap_docÚnorm_docÚmulti_norm_docÚvmin_vmax_docÚmulti_vmin_vmax_docc                   ó^   ‡ — e Zd ZdZˆ fd„Zed„ ¦   «         Zej        d„ ¦   «         Zd„ Zˆ xZ	S )ÚColorizingArtistzß
    Base class for artists that make map data to color using a `.colorizer.Colorizer`.

    The `.colorizer.Colorizer` applies data normalization before
    returning RGBA colors from a `~matplotlib.colors.Colormap`.

    c                 ót   •— t          j        t          |¬¦  «          t          ¦   «         j        dd|i|¤Ž dS )zZ
        Parameters
        ----------
        colorizer : `.colorizer.Colorizer`
        rÞ   rß   Nr‹   )r   Úcheck_isinstancer   r•   r   )r   rß   rã   r˜   s      €r   r   zColorizingArtist.__init__Á  sC   ø€ õ 	Ô�i°9Ð=Ñ=Ô=Ð=Ø�‰ŒÔÐ7Ð7 9Ð7°Ð7Ð7Ð7Ð7Ð7r   c                 ó   — | j         S r(   )r�   r)   s    r   rß   zColorizingArtist.colorizerÊ  s
   € àŒÐr   c                 óÜ   — t          j        t          |¬¦  «         | j        j                             | j        ¦  «         || _        |j                             d| j        ¦  «        | _        d S )NrÞ   r   )	r   r  r   r�   r   r/   râ   r0   r   )r   Úcls     r   rß   zColorizingArtist.colorizerÎ  s]   € åÔ�i°2Ð6Ñ6Ô6Ð6ØŒÔ!×,Ò,¨TÔ-?Ñ@Ô@Ð@ØˆŒØœ\×1Ò1°)¸T¼\ÑJÔJˆÔÐÐr   c                 ó0   —  | j         |fi |¤Ž || _        dS )z[
        Raises a ValueError if any kwarg is not None while colorizer is not None.
        N)rù   rß   )r   rß   rã   s      r   Ú_set_colorizer_check_keywordsz.ColorizingArtist._set_colorizer_check_keywordsÕ  s*   € ð 	*ˆÔ)¨)Ð>Ð>°vÐ>Ð>Ð>Ø"ˆŒˆˆr   )
r„   r…   r†   r‡   r   rˆ   rß   r‰   r	  rÚ   rÛ   s   @r   r  r  ¹  sŽ   ø€ € € € € ðð ð8ð 8ð 8ð 8ð 8ð ðð ñ „Xðð ÔðKð Kñ ÔðKð#ð #ð #ð #ð #ð #ð #r   r  c                 ó(  — 	   t          j        t          j        | d¬¦  «        ¦  «        t           j        ¦  «        ¦   «         }n?# t
          $ r2   t          j        | ¦  «        t           j        ¦  «        ¦   «         }Y nw xY wt          |¦  «        S )a¸  
    Automatically generate a norm class from *scale_cls*.

    This differs from `.colors.make_norm_from_scale` in the following points:

    - This function is not a class decorator, but directly returns a norm class
      (as if decorating `.Normalize`).
    - The scale is automatically constructed with ``nonpositive="mask"``, if it
      supports such a parameter, to work around the difference in defaults
      between standard scales (which use "clip") and norms (which use "mask").

    Note that ``make_norm_from_scale`` caches the generated norm classes
    (not the instances) and reuses them for later calls.  For example,
    ``type(_auto_norm_from_scale("log")) == LogNorm``.
    Úmask)Únonpositive)r   Úmake_norm_from_scaleÚ	functoolsÚpartialr    r[   rd   )Ú	scale_clsr   s     r   Ú_auto_norm_from_scaler  Ý  s±   € ð$ ðð >�vÔ*ÝÔ˜i°VÐ<Ñ<Ô<ñ>ô >åÔñô ñ  ô  ˆˆøõ ð  ð  ð  ðÐ5�vÔ*¨9Ñ5Ô5ÝÔñô ñ  ô  ˆˆˆð øøøõ �‰:Œ:Ðs   ‚AA Á9BÂBrA   c                 óš  — |dk    rŒt          j        t          j        t          d f| ¬¦  «         | €t          j        ¦   «         } nLt          | t          ¦  «        r7t          j        t          j	        | ¬¦  «        } t          |¦  «        ¦   «         S | S |dk    r¥t          j        | ¦  «        s(t          j        t          j        d t          f| ¬¦  «         | €t          j        dg|z  ¦  «        } nt          j        | ¦  «        } t          | t          j        ¦  «        r| j        |k    r| S t!          d|› d�¦  «        ‚t!          d¦  «        ‚)NrA   r§   Úlinearz,Invalid norm for multivariate colormap with z inputszHInvalid cmap. A colorizer object must have a cmap with `n_variates` >= 1)r   r  r   ÚNormÚstrr    r   Úgetitem_checkedr   Ú_scale_mappingr  r7   Úiterabler¾   Útupler,   r!   )r   r,   r  s      r   r-   r-   ù  sW  € Ø�qÒÐÝÔ�vœ{­C°Ð6¸TÐBÑBÔBÐBØˆ<ÝÔ#Ñ%Ô%ˆDˆDÝ˜�cÑ"Ô"ð 	6ÝÔ,­UÔ-AÈÐMÑMÔMˆIØ3Õ(¨Ñ3Ô3Ñ5Ô5Ð5ØˆØ	˜Ò	Ð	ÝŒ{˜4Ñ Ô ð 	NÝÔ!¥6Ô#3°T½5Ð"AÈÐMÑMÔMÐMØˆ<ÝÔ# X J¨|Ñ$;Ñ<Ô<ˆDˆDåÔ# DÑ)Ô)ˆDÝ�d�FÔ,Ñ-Ô-ð 	°$Ô2CÀ|Ò2SÐ2SØˆKÝØP¸<ÐPÐPÐPñRô Rð 	Rõ ØVñXô Xð 	Xr   Fc                 óœ  — |rGt           j        t           j        t           j        f}t          j        t          j        t          j        f}nt           j        f}t          j        f}t          | |¦  «        r| S t	          j	        | d¦  «        }|D ]}||v r
||         c S Œt          t          j        d| t          j        ¦  «        dz   ¦  «        ‚)aº  
    Ensure that we have a `.Colormap` object.

    For internal use to preserve type stability of errors.

    Parameters
    ----------
    cmap : None, str, Colormap

        - if a `~matplotlib.colors.Colormap`,
          `~matplotlib.colors.MultivarColormap` or
          `~matplotlib.colors.BivarColormap`,
          return it
        - if a string, look it up in three corresponding databases
          when not found: raise an error based on the expected shape
        - if None, look up the default color map in mpl.colormaps
    accept_multivariate : bool, default False
        - if False, accept only Colormap, string in mpl.colormaps or None

    Returns
    -------
    Colormap

    z
image.cmapr   zr
See `matplotlib.bivar_colormaps()` and `matplotlib.multivar_colormaps()` for bivariate and multivariate colormaps)r   ÚColormaprÀ   ÚMultivarColormapÚmplÚ	colormapsÚmultivar_colormapsÚbivar_colormapsr   Ú
_val_or_rcr!   r   Úlist_suggestion_error_msg)r   rb   ÚtypesÚmappingsÚ	cmap_nameÚmappings         r   rc   rc     sÓ   € ð2 ð %Ý”¥&Ô"6½Ô8OÐPˆÝ”M¥3Ô#9½3Ô;NÐOˆˆå”Ð#ˆÝ”MÐ$ˆå�$˜ÑÔð Øˆå”˜t \Ñ2Ô2€Iàð &ð &ˆØ˜ÐÐØ˜9Ô%Ð%Ð%Ð%ð  õ •TÔ3°F¸DÅ#Ä-ÑPÔPð=ñ=ñ >ô >ð >r   c                 óŠ  — t          | t          j        ¦  «        �r4t          | j        j        ¦  «        |k    r| S | j        t          j        t          j        fv rö|dk    rt          d|› d�¦  «        ‚| j        t          j        k    rt          j        d¦  «        }nt          j        d¦  «        }t          j	         
                    t          j	                             | ¦  «                             |¦  «        ¦  «        }t          j	                             | ¦  «        r/|j        D ]'}t          j	        j        ||d                  | j        <   Œ(|S |dk    �r;t          | ¦  «        |k    �r'd„ | D ¦   «         } t          j        d	                     d
„ | D ¦   «         ¦  «        ¦  «        }d„ |j        D ¦   «         }t          j	                             | d         j        |¬¦  «        }t'          |¦  «        D ]›\  }}| |         j        |j        k    r+t          d| d         j        › d| |         j        › �¦  «        ‚| |         ||<   t          j	                             | |         ¦  «        r%t          j	        j        ||         | |         j        <   Œœ|S |dk    r| S |dk    rt          d¦  «        ‚t          d|› d|› d�¦  «        ‚)a¥  
    Ensure that the data has dtype with n_components.
    Input data of shape (n_components, n, m) is converted to an array of shape
    (n, m) with data type np.dtype(f'{data.dtype}, ' * n_components)
    Complex data is returned as a view with dtype np.dtype('float64, float64')
    or np.dtype('float32, float32')
    If n_components is 1 and data is not of type np.ndarray (i.e. PIL.Image),
    the data is returned unchanged.
    If data is None, the function returns None

    Parameters
    ----------
    n_components : int
        Number of variates in the data.
    data : np.ndarray, PIL.Image or None

    Returns
    -------
    np.ndarray, PIL.Image or None
    r@   zPInvalid data entry for multivariate data. Complex numbers are incompatible with z
 variates.zfloat64, float64zfloat32, float32r   rA   c                 óP   — g | ]#}t           j                             |d ¬¦  «        ‘Œ$S )Frå   )r7   r   rÒ   r±   s     r   r´   z-_ensure_multivariate_data.<locals>.<listcomp>t  s*   € Ð?Ð?Ð?°$•”—’˜D u�Ñ-Ô-Ð?Ð?Ð?r   r»   c                 ó   — g | ]
}|j         › ‘ŒS r‹   ©rE   r±   s     r   r´   z-_ensure_multivariate_data.<locals>.<listcomp>u  s   € Ð BÐ BÐ B°T D¤J Ð BÐ BÐ Br   c                 ó   — g | ]
}|d          ‘ŒS )r   r‹   )r²   Ú
descriptors     r   r´   z-_ensure_multivariate_data.<locals>.<listcomp>v  s   € Ð;Ð;Ð; J�*˜Q”-Ð;Ð;Ð;r   r*  z=For multivariate data all variates must have same shape, not z and zŒInvalid data entry for multivariate data. The data must contain complex numbers, or have a first dimension 2, or be of a dtype with 2 fieldsz\Invalid data entry for multivariate data. The shape of the data must have a first dimension z or be of a dtype with z fields)r   r7   r8   ÚlenrE   ÚdescrÚ	complex64Ú
complex128r!   r   rÒ   ÚgetdataÚviewrR   Úmaskedr  rÃ   rI   rD   Ú	enumerate)rÄ   r,   ÚdtÚreconstructedr,  rê   ÚirF   s           r   rç   rç   D  së  € õ, �$�œ
Ñ#Ô#ñ !ÝˆtŒzÔÑ Ô  LÒ0Ð0ð ˆKØŒZ�BœL­"¬-Ð8Ð8Ð8Ø˜qÒ Ð Ý ð "=à$0ð"=ð "=ð "=ñ >ô >ð >ð
 Œz�Rœ]Ò*Ð*Ý”XÐ0Ñ1Ô1��å”XÐ0Ñ1Ô1�åœEŸKšK­¬¯ª°dÑ(;Ô(;×(@Ò(@ÀÑ(DÔ(DÑEÔEˆMÝŒu�Š˜tÑ$Ô$ð KØ"$¤(ð Kð K�JÝ>@¼e¼l�M *¨Q¤-Ô0°´Ñ;Ð;Ø Ð à�aÒÑ�C ™IœI¨Ò5Ñ5ð @Ð?¸$Ð?Ñ?Ô?ˆÝŒX�d—i’iÐ BÐ B¸TÐ BÑ BÔ BÑCÔCÑDÔDˆØ;Ð;°"´(Ð;Ñ;Ô;ˆÝœŸš D¨¤G¤M¸˜Ñ<Ô<ˆÝ˜fÑ%Ô%ð 	>ð 	>‰DˆAˆqØ�AŒwŒ} Ô 3Ò3Ð3Ý ð "SØ/3°A¬w¬}ð"Sð "SØCGÈÄ7Ä=ð"Sð "Sñ Tô Tð Tà# AœwˆM˜!ÑÝŒu�Š˜t AœwÑ'Ô'ð >Ý13´´�˜aÔ   a¤¤Ñ.øØÐà�qÒÐàˆà	˜Ò	Ð	Ýð ;ñ <ô <ð 	<õ ð IØEQðIð Ià3?ðIð Ið Iñ Jô Jð 	Jr   )rA   )F)r‡   r  Únumpyr7   r   Ú
matplotlibr   r   r   r   r   r  Ú
_docstringÚinterpdÚregisterr   r�   rÝ   ÚArtistr  r  r-   rc   rç   r‹   r   r   ú<module>r>     s  ððð ð* Ð Ð Ð à Ð Ð Ð Ø Ð Ð Ð Ð Ð à 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø Ð Ð Ð à „Ô × Ò ð3ð  ñ ô ð ðSð Sð Sð Sð Sñ Sô Sð SðlGð Gð Gð Gð Gñ Gô Gð GðTp%ð p%ð p%ð p%ð p%Ð)ñ p%ô p%ð p%ðf „Ô × Ò ððððOð8ð
.ðe  ñ =ô =ð =ð@!#ð !#ð !#ð !#ð !#�¨¬ñ !#ô !#ð !#ðHð ð ð8Xð Xð Xð Xð2/>ð />ð />ð />ðdHJð HJð HJð HJð HJr   