Files
intellecton/venv/lib/python3.12/site-packages/matplotlib/__pycache__/cm.cpython-312.pyc
T

174 lines
12 KiB
Plaintext
Raw Normal View History

Ë
†Rjn(ãóF—dZddlmZddlZddlmZmZddlmZ ddl
m Z ddl m
ZddlmZddlm
Zej(d Zd
„ZGd „d e«Zee««Ze«j5e«ee«Zee«Zej:d
dd¬«dd„«Zd„Zy)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ó —it¥}tj«D]i\}}d|vrtj||t
«nAd|vrtj |d|«n$tjj||t
«||<Œkdddddœ}|j«D]$\}}||j«}||_ |||<Œ&t|j««D]!}|j«}|||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 úP/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/cm.pyÚ_gen_cmap_registryr( s€ð
” Ð
€FÜ—k‘k“mòL‰
ˆˆdð˜‰}ô
× *Ñ *¨4°´xÔ @ð˜4Ñô
× !Ñ ! $ x¡.°$Ô 7ä × *Ñ *× 4Ñ 4°T¸4ÄÓ Jð ˆtŠ ðLðØ Ø Øñ €Gð!(§
¡
£òшˆ}Ø�mÑ$×)Ñ)Ó+ˆØˆŒ ؈ˆuŠ
ðô �V—]‘]“_Ó%ò!ˆØ�}‰}‹ˆØ ˆˆt�y‰yÒð!ð €MócóN—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z dd d
œd „Z
d „Z d
„Z y)Ú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ó2—||_t|«|_y©N)Ú_cmapsÚtupleÚ_builtin_cmaps)Úselfrs r'Ú__init__zColormapRegistry.__init__Zs€ØˆŒ Ü# E›lˆÕr)cóv— |j|j«S#t$rt|›d�«d‚wxYw)Nz is not a known colormap name)r.rÚKeyError)r1Úitems r'Ú __getitem__zColormapRegistry.__getitem__^sF€ð OØ—;‘;˜tÑ$×)Ñ)Ó+Ð +øÜò Oܘd˜XÐ%BÐCÓDÈ$Ð Nð Oús‚Ÿ8có,—t|j«Sr-)Úiterr.©r1s r'Ú__iter__zColormapRegistry.__iter__ds€Ü�D—K‘KÓ Ð r)có,—t|j«Sr-)Úlenr.r9s r'Ú__len__zColormapRegistry.__len__gs€Ü�4—;‘;ÓÐr)có8—ddjd„|D««zS)Nz'ColormapRegistry; available colormaps:
z, c3ó(K—|]
}d|›d�–—Œ y­w)ú'N©)Ú.0rs r'ú <genexpr>z+ColormapRegistry.__str__.<locals>.<genexpr>lsèø€Ò7¨$˜A˜d˜V 1œ+Ñ7ùs‚)Újoinr9s r'Ú__str__zColormapRegistry.__str__js!€Ø:Ø— ‘ Ñ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)``.
)rr9s r'Ú__call__zColormapRegistry.__call__ns€ô�D‹zÐr)NF)rÚforcecó —tjtj|¬«|xs |j}||vrG|st d|›d�«‚||j vrt d|›d�«‚tjd|›d�«|j«|j|<|j|j|k7r||j|_yy) 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%zA colormap named "z" is already registered.z Re-registering the builtin cmap z is not allowed.zOverwriting the cmap z" that was already in the registry.N)
rÚcheck_isinstancerÚColormaprÚ
ValueErrorr0Ú
warn_externalrr.)r1r%rrHs r'ÚregisterzColormapRegistry.registerxsâ€ô2
×ÑœfŸo™o°DÕ9àÒ �t—y‘yˆØ �4‰<Ùô!Ø(¨¨Ð.FÐGóIðIà˜×,Ñ,Ñ,ä Ð!CØ$( 8Ð+;ð"=ó>ð>ô
× Ñ Ð!6°t°hð?Cð Cô
Dð!ŸI™I›Kˆ� ‰ �DÑð �;‰;�tÑ × !Ñ ! TÒ )Ø%)ˆD�K‰K˜Ñ Õ "ð *r)cóv—||jvrtd|›d�«‚|jj|d«y)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.
zcannot unregister z which is a builtin colormap.N)r0rMr.Úpop)r1rs r'Ú
unregisterzColormapRegistry.unregisterªsB€ð6 �4×&Ñ&Ñ &ÜÐ1°$°ð:)ð)ó*ð
*à � ‰ �‰˜˜dÕ#r)c ó—|€|tjdSt|tj«r|St|t
«r)t
jtt«|¬«||Stdd|›dt|«›�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
ú
image.cmaprJz<get_cmap expects None or an instance of a str or Colormap . z you passed z of type ) ÚmplÚrcParamsÚ
isinstancerrLÚstrrÚ
check_in_listÚsortedÚ
_colormapsÚ TypeErrorÚtype)r1r%s r'Úget_cmapzColormapRegistry.get_cmapÊs„€ð" ˆ<ØœŸ ™  \Ñ2Ñ3Ð 3ô �dœFŸO™OÔ ,؈KÜ �dœCÔ Ü × Ñ œv¤jÓ1¸Õ =à˜‘:Ð ÜØ Jؘ$˜ ¬4°«:¨,Ð 7ñ
8ó
ð
r))
Ú__name__Ú
__module__Ú __qualname__Ú__doc__r2r6r:r=rErGrOrRr^rAr)r'r+r+Bs>„ñò.+òOò !ò ò9òð&*°ô0*òd$ó@
r)r+z3.7z3.11z^``matplotlib.colormaps[name]`` or ``matplotlib.colormaps.get_cmap()`` or ``pyplot.get_cmap()``)ÚremovalÚ alternativecóò—|€tjd}t|tj«r|St j tt«|¬«|€ t|St|j|«S)ah
Get a colormap instance, defaulting to rc values if *name* is None.
Parameters
----------
name : `~matplotlib.colors.Colormap` or str or None, default: None
If a `.Colormap` instance, it will be returned. Otherwise, the name of
a colormap known to Matplotlib, which will be resampled by *lut*. The
default, None, means :rc:`image.cmap`.
lut : int or None, default: None
If *name* is not already a Colormap instance and *lut* is not None, the
colormap will be resampled to have *lut* entries in the lookup table.
Returns
-------
Colormap
rT)r)
rUrVrWrrLrrYrZr[Ú resampled)rÚluts r'r^r^ùse€ð0 €|Ü�|‰|˜LÑ)ˆÜ�$œŸ™Ô(؈ Ü×Ñ”vœjÓ)°Õ5Ø
€{ܘ$ÑÐä˜$Ñ×)Ñ)¨#Ó.Ð.r)cóæ—t|tj«r|S|�|ntjd}|t
vr$t
jtt
«|¬«tj|S)ao
Ensure that we have a `.Colormap` object.