§
    õŽ’j¹   ã                   ó2  — d Z ddlmZ ddlZddlmZmZ ddlmZ	 ddl
mZ ddlmZ ddlmZ ddlmZ ej        d	         Zd
„ Z G d„ de¦  «        Z e e¦   «         ¦  «        Z e¦   «                              e¦  «          ee¦  «        Z ee¦  «        ZdS )a|  
Builtin colormaps, colormap handling utilities, and the `ScalarMappable` mixin.

.. seealso::

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

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

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

  :ref:`colormapnorms` for more details about data normalization.
é    )ÚMappingN)Ú_apiÚcolors)Ú_ScalarMappable)Údatad)Úcmaps)Úcmap_familiesz	image.lutc                  ó*  — i t           ¥} t          j        ¦   «         D ]l\  }}d|v rt          j        ||t
          ¦  «        nDd|v rt          j        |d         |¦  «        n%t          j                             ||t
          ¦  «        | |<   Œmdddddœ}|                     ¦   «         D ]+\  }}| |                              ¦   «         }||_	        || |<   Œ,t          |                      ¦   «         ¦  «        D ] }|                     ¦   «         }|| |j	        <   Œ!| S )zw
    Generate a dict mapping standard colormap names to standard colormaps, as
    well as the reversed colormaps.
    ÚredÚlistedÚgrayÚ	gist_grayÚ	gist_yargÚGreys)ÚgreyÚ	gist_greyÚ	gist_yergÚGrays)Úcmaps_listedr   Úitemsr   ÚLinearSegmentedColormapÚ_LUTSIZEÚListedColormapÚ	from_listÚcopyÚnameÚlistÚvaluesÚreversed)Úcmap_dr   ÚspecÚaliasesÚaliasÚoriginal_nameÚcmapÚrmaps           ú;C:\Projects\DSCons\.venv\Lib\site-packages\matplotlib\cm.pyÚ_gen_cmap_registryr(       s6  € ð
 •Ð€FÝ”k‘m”mð Lð L‰
ˆˆdð ˜ˆ}ˆ}õ Ô*¨4°µxÑ@Ô@Ð@ð ˜4ÐÐõ Ô! $ x¤.°$Ñ7Ô7Ð7åÔ*×4Ò4°T¸4ÅÑJÔJð 	ˆt‰ˆð Ø Ø Øðð €Gð !(§¢¡¤ð ð Ñˆˆ}Ø�mÔ$×)Ò)Ñ+Ô+ˆØˆŒ	Øˆˆu‰ˆõ �V—]’]‘_”_Ñ%Ô%ð !ð !ˆØ�}Š}‰ŒˆØ ˆˆtŒyÑÐØ€Mó    c                   óP   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dd	d
œd„Z
d„ Zd„ ZdS )ÚColormapRegistryaç  
    Container for colormaps that are known to Matplotlib by name.

    The universal registry instance is `matplotlib.colormaps`. There should be
    no need for users to instantiate `.ColormapRegistry` themselves.

    Read access uses a dict-like interface mapping names to `.Colormap`\s::

        import matplotlib as mpl
        cmap = mpl.colormaps['viridis']

    Returned `.Colormap`\s are copies, so that their modification does not
    change the global definition of the colormap.

    Additional colormaps can be added via `.ColormapRegistry.register`::

        mpl.colormaps.register(my_colormap)

    To get a list of all registered colormaps, you can do::

        from matplotlib import colormaps
        list(colormaps)
    c                 ó<   — || _         t          |¦  «        | _        d S ©N)Ú_cmapsÚtupleÚ_builtin_cmaps)Úselfr   s     r'   Ú__init__zColormapRegistry.__init__Z   s   € ØˆŒÝ# E™lœlˆÔÐÐr)   c                 ól   — t          j        | j        |t          ¬¦  «        }|                     ¦   «         S )N)ÚcolormapÚ
_error_cls)r   Úgetitem_checkedr.   ÚKeyErrorr   )r1   Úitemr%   s      r'   Ú__getitem__zColormapRegistry.__getitem__^   s)   € ÝÔ# D¤K¸$Í8ÐTÑTÔTˆØ�yŠy‰{Œ{Ðr)   c                 ó*   — t          | j        ¦  «        S r-   )Úiterr.   ©r1   s    r'   Ú__iter__zColormapRegistry.__iter__b   s   € Ý�D”KÑ Ô Ð r)   c                 ó*   — t          | j        ¦  «        S r-   )Úlenr.   r<   s    r'   Ú__len__zColormapRegistry.__len__e   s   € Ý�4”;ÑÔÐr)   c                 óF   — dd                      d„ | D ¦   «         ¦  «        z   S )Nz'ColormapRegistry; available colormaps:
z, c              3   ó"   K  — | ]
}d |› d �V — ŒdS )ú'N© )Ú.0r   s     r'   ú	<genexpr>z+ColormapRegistry.__str__.<locals>.<genexpr>j   s*   è è € Ð7Ð7¨$˜+˜d˜+˜+˜+Ð7Ð7Ð7Ð7Ð7Ð7r)   )Újoinr<   s    r'   Ú__str__zColormapRegistry.__str__h   s-   € Ø:Ø—	’	Ð7Ð7°$Ð7Ñ7Ô7Ñ7Ô7ñ8ð 	9r)   c                 ó    — t          | ¦  «        S )zü
        Return a list of the registered colormap names.

        This exists only for backward-compatibility in `.pyplot` which had a
        ``plt.colormaps()`` method. The recommended way to get this list is
        now ``list(colormaps)``.
        )r   r<   s    r'   Ú__call__zColormapRegistry.__call__l   s   € õ �D‰zŒzÐr)   NF)r   Úforcec                ó~  — t          j        t          j        |¬¦  «         |p|j        }|| v rI|st          d|› d�¦  «        ‚|| j        v rt          d|›d�¦  «        ‚t          j        d|›d�¦  «         |                     ¦   «         | j	        |<   | j	        |         j        |k    r|| j	        |         _        dS dS )	a¦  
        Register a new colormap.

        The colormap name can then be used as a string argument to any ``cmap``
        parameter in Matplotlib. It is also available in ``pyplot.get_cmap``.

        The colormap registry stores a copy of the given colormap, so that
        future changes to the original colormap instance do not affect the
        registered colormap. Think of this as the registry taking a snapshot
        of the colormap at registration.

        Parameters
        ----------
        cmap : matplotlib.colors.Colormap
            The colormap to register.

        name : str, optional
            The name for the colormap. If not given, ``cmap.name`` is used.

        force : bool, default: False
            If False, a ValueError is raised if trying to overwrite an already
            registered name. True supports overwriting registered colormaps
            other than the builtin colormaps.
        ©r%   zA colormap named "z" is already registered.z Re-registering the builtin cmap z is not allowed.zOverwriting the cmap z" that was already in the registry.N)
r   Úcheck_isinstancer   ÚColormapr   Ú
ValueErrorr0   Úwarn_externalr   r.   )r1   r%   r   rK   s       r'   ÚregisterzColormapRegistry.registerv   s  € õ2 	Ô�fœo°DÐ9Ñ9Ô9Ð9àÐ �t”yˆØ�4ˆ<ˆ<Øð >õ !ØG¨ÐGÐGÐGñIô Ið Ià˜Ô,Ð,Ð,å ð "=Ø$(ð"=ð "=ð "=ñ >ô >ð >õ Ôð  C°tð  Cð  Cð  Cñ Dô Dð Dð !ŸIšI™KœKˆŒ�DÑð Œ;�tÔÔ! TÒ)Ð)Ø%)ˆDŒK˜ÔÔ"Ð"Ð"ð *Ð)r)   c                 ót   — || j         v rt          d|›d�¦  «        ‚| j                             |d¦  «         dS )a  
        Remove a colormap from the registry.

        You cannot remove built-in colormaps.

        If the named colormap is not registered, returns with no error, raises
        if you try to de-register a default colormap.

        .. warning::

            Colormap names are currently a shared namespace that may be used
            by multiple packages. Use `unregister` only if you know you
            have registered that name before. In particular, do not
            unregister just in case to clean the name before registering a
            new colormap.

        Parameters
        ----------
        name : str
            The name of the colormap to be removed.

        Raises
        ------
        ValueError
            If you try to remove a default built-in colormap.
        zcannot unregister z which is a builtin colormap.N)r0   rP   r.   Úpop)r1   r   s     r'   Ú
unregisterzColormapRegistry.unregister¨   sV   € ð6 �4Ô&Ð&Ð&Ýð )°$ð )ð )ð )ñ *ô *ð *àŒ�Š˜˜dÑ#Ô#Ð#Ð#Ð#r)   c           	      óB  — |€| t           j        d                  S t          |t          j        ¦  «        r|S t          |t
          ¦  «        r0t          j        t          t          ¦  «        |¬¦  «         | |         S t          dd|›dt          |¦  «        › �z   ¦  «        ‚)a€  
        Return a color map specified through *cmap*.

        Parameters
        ----------
        cmap : str or `~matplotlib.colors.Colormap` or None

            - if a `.Colormap`, return it
            - if a string, look it up in ``mpl.colormaps``
            - if None, return the Colormap defined in :rc:`image.cmap`

        Returns
        -------
        Colormap
        Nz
image.cmaprM   z<get_cmap expects None or an instance of a str or Colormap . zyou passed z	 of type )ÚmplÚrcParamsÚ
isinstancer   rO   Ústrr   Úcheck_in_listÚsortedÚ
_colormapsÚ	TypeErrorÚtype)r1   r%   s     r'   Úget_cmapzColormapRegistry.get_cmapÈ   s£   € ð" ˆ<Ø�œ \Ô2Ô3Ð3õ �d�FœOÑ,Ô,ð 	ØˆKÝ�d�CÑ Ô ð 	ÝÔ�v¥jÑ1Ô1¸Ð=Ñ=Ô=Ð=à˜”:ÐÝØJØ7˜$Ð7Ð7­4°©:¬:Ð7Ð7ñ8ñ
ô 
ð 	
r)   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r2   r9   r=   r@   rH   rJ   rR   rU   r`   rD   r)   r'   r+   r+   B   s¸   € € € € € ðð ð.+ð +ð +ðð ð ð!ð !ð !ð ð  ð  ð9ð 9ð 9ðð ð ð &*°ð 0*ð 0*ð 0*ð 0*ð 0*ðd$ð $ð $ð@
ð 
ð 
ð 
ð 
r)   r+   )rd   Úcollections.abcr   Ú
matplotlibrW   r   r   Úmatplotlib.colorizerr   ÚScalarMappableÚmatplotlib._cmr   Úmatplotlib._cm_listedr   r   Úmatplotlib._cm_multivarr	   Úmultivar_cmapsÚmatplotlib._cm_bivarÚbivar_cmapsrX   r   r(   r+   r]   ÚglobalsÚupdateÚ_multivar_colormapsÚ_bivar_colormapsrD   r)   r'   ú<module>rs      sP  ððð ð  $Ð #Ð #Ð #Ð #Ð #à Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #Ð #Ð #à BÐ BÐ BÐ BÐ BÐ BØ  Ð  Ð  Ð  Ð  Ð  Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø CÐ CÐ CÐ CÐ CÐ CØ 5Ð 5Ð 5Ð 5Ð 5Ð 5ð Œ<˜Ô$€ðð ð ðDd
ð d
ð d
ð d
ð d
�wñ d
ô d
ð d
ðT ÐÐ0Ð0Ñ2Ô2Ñ3Ô3€
Ø €�	„	× Ò �Ñ Ô Ð à&Ð& ~Ñ6Ô6Ð à#Ð# KÑ0Ô0Ð Ð Ð r)   