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(ãóFdZddlmZddlZddlmZmZddlmZ ddl
m Z ddl m
ZddlmZddlm
Zej(d Zd
ZGd d e«Zee««Ze«j5e«ee«Zee«Zej:d
dd¬«dd«ZdZy)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
ˆˆ˜‰}ô
× *¨4°´xÔ ˜4Ñô
× ! $ x¡.°$Ô × 4°T¸4ÄÓ ˆtŠ ðLðØ Ø Øñ €Gð!(§
¡
£òшˆ}ØØˆŒ ؈ˆuŠ
ðô V—]‘]“_ÓØ}‰}‹ˆØ ˆˆty‰yÒð €MócóNeZdZdZdZdZdZdZdZdZ 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«dwxYw)Nz is not a known colormap name)r.rÚKeyError)r1Úitems r'Ú __getitem__zColormapRegistry.__getitem__^sFð OØ—;‘;˜tÑ +øÜò Oܘd˜XÐ%BÐDÈ$Ð  OúsŸ8có,t|j«Sr-)Úiterr.©r1s r'Ú__iter__zColormapRegistry.__iter__dsÜD—K Ð r)có,t|j«Sr-)Úlenr.r9s r'Ú__len__zColormapRegistry.__len__gsÜ4—;Ðr)có8ddjd|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°$Ô 9r)cót|«S)
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ôDr)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.registerxô2
×ÑœfŸo™o°DÕÒ t—y‘yˆØ 4‰<Ùô¨Ð.FÐIðIà˜× Ð!CØ$( 8Ð+;ð"=ó
× Ñ Ð!6°t°hð?Cð Cô
Dð!ŸI™I›Kˆ ð ;‰; × ! TÒ )Ø%)ˆDK‰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„ð" ˆœŸ    dœFŸO™OÔ ˆKÜ dœCÔ Ü × Ñ œv¤jÓÕ ˜‘:Ð ÜØ ˜$˜ ¬4°«:¨,Ð 

ð
r))
Ú__name__Ú
__module__Ú __qualname__Ú__doc__r2r6r:r=rErGrOrRr^rAr)r'r+r+Bs>ñò.Oò  òð&*°ô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ÓÕ
€{ܘ$ÑÐä˜$Ñ×)¨#Ó.r)cóæt|tj«r|S||ntjd}|t
vr$t
jtt
«|¬«tj|S)ao
Ensure that we have a `.Colormap` object.