Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/matplotlib/__pycache__/cm.cpython-37.pyc

198 lines
12 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
U<>]<5D>3<00>@s<>dZddlZddlZddlmZddlZddlmZddl m
Z
ddl m Z ddl mZiZddd<07>Zdd <09>Zd
d <0B>Zd d <0A>ZejdZe <0C>dd<10>e <0C><18>D<00><01>xe D]Zeee<16>ee<q<>We<10>e<0F>e<1A><00>e<10>ddd<12>Zddd<14>ZGdd<16>de<1D>ZdS)a<>
Builtin colormaps, colormap handling utilities, and the `ScalarMappable` mixin.
.. seealso::
:doc:`/gallery/color/colormap_reference` for a list of builtin
colormaps.
:doc:`/tutorials/colors/colormap-manipulation` for examples of how to
make colormaps and
:doc:`/tutorials/colors/colormaps` an in-depth discussion of
choosing colormaps.
:doc:`/tutorials/colors/colormapnorms` for more details about data
normalization
<EFBFBD>N)<01>ma)<01>datad)<01>cmapscCs |dkrt<00>t|<00>S|d|<00>S)z1Helper such that ``_reverser(f)(x) == f(1 - x)``.N<>)<03> functools<6C>partial<61> _reverser)<02>f<>x<>r <00>5/tmp/pip-install-i8dhxrtk/matplotlib/matplotlib/cm.pyr(s rcCsJi}x@|<00><00>D]4\}}t|<03>r(t|<03>}ndd<02>t|<03>D<00>}|||<qW|S)z:Can only handle specification *data* in dictionary format.cSs g|]\}}}d|||f<03>qS)g<00>?r )<04>.0r
Zy0<79>y1r r r <00>
<listcomp><szrevcmap.<locals>.<listcomp>)<04>items<6D>callabler<00>reversed)<05>dataZdata_r<5F>key<65>valZvalnewr r r <00>revcmap0s
 rcCs`d|krd|dddd<03>iSd|kr.t|<00>Stt|<00><01>}t|d<00>dkrXdd<08>|D<00>}|SdS) zRReverses cmap specification *spec*, can handle both dict and tuple
type specs.<2E>listedN<64><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>redr<00>cSsg|]\}}d||f<02>qS)g<00>?r )r <00>a<>br r r rMsz&_reverse_cmap_spec.<locals>.<listcomp>)r<00>listr<00>len)<02>specZrevspecr r r <00>_reverse_cmap_specAs r cCsJt|}d|krt<01>|||<01>Sd|kr6t<01>|d|<00>Stj<02>|||<01>SdS)zMGenerates the requested cmap from its *name*. The lut size is
*lutsize*.rrN)r<00>colors<72>LinearSegmentedColormapZListedColormap<61> from_list)<03>nameZlutsizerr r r <00>_generate_cmapQs r%z image.lutcCsi|]\}}t|<02>|d<00>qS)<01>_r)r )r <00>cmapnamerr r r <00>
<dictcomp>dsr(cCs<>|dkr0y
|j}Wntk
r.td<02><01>YnXt|t<04>sBtd<03><01>t|tj<06>rZ|t|<dS|dkrltj d}t<05>
|||<03>}|t|<dS)aj
Add a colormap to the set recognized by :func:`get_cmap`.
It can be used in two ways::
register_cmap(name='swirly', cmap=swirly_cmap)
register_cmap(name='choppy', data=choppydata, lut=128)
In the first case, *cmap* must be a :class:`matplotlib.colors.Colormap`
instance. The *name* is optional; if absent, the name will
be the :attr:`~matplotlib.colors.Colormap.name` attribute of the *cmap*.
In the second case, the three arguments are passed to
the :class:`~matplotlib.colors.LinearSegmentedColormap` initializer,
and the resulting colormap is registered.
Nz+Arguments must include a name or a ColormapzColormap name must be a stringz image.lut) r$<00>AttributeError<6F>
ValueError<EFBFBD>
isinstance<EFBFBD>strr!<00>Colormap<61>cmap_d<5F>mpl<70>rcParamsr")r$<00>cmapr<00>lutr r r <00> register_cmapts

 
r3cCsh|dkrtjd}t|tj<04>r"|S|tkrJ|dkr:t|St|<00>|<01>Sntd|d<04>t t<05><01>f<00><01>dS)a<>
Get a colormap instance, defaulting to rc values if *name* is None.
Colormaps added with :func:`register_cmap` take precedence over
built-in colormaps.
If *name* is a :class:`matplotlib.colors.Colormap` instance, it will be
returned.
If *lut* is not None it must be an integer giving the number of
entries desired in the lookup table, and *name* must be a standard
mpl colormap name.
Nz
image.cmapz6Colormap %s is not recognized. Possible values are: %sz, )
r/r0r+r!r-r.Z _resampler*<00>join<69>sorted)r$r2r r r <00>get_cmap<61>s
 r6c@s<>eZdZdZd#dd<04>Zd$dd<08>Zd d
<EFBFBD>Zd d <0C>Zd d<0E>Zdd<10>Z d%dd<12>Z
dd<14>Z dd<16>Z dd<18>Z dd<1A>Zdd<1C>Zdd<1E>Zdd <20>Zd!d"<22>ZdS)&<26>ScalarMappablez<65>
This is a mixin class to support scalar data to RGBA mapping.
The ScalarMappable makes use of data normalization before returning
RGBA colors from the given colormap.
NcCsRt<00><01>|_|dkrt<03>}|dkr(t<04><05>}d|_||_t|<02>|_d|_ ddi|_
dS)a<>
Parameters
----------
norm : :class:`matplotlib.colors.Normalize` instance
The normalizing object which scales data, typically into the
interval ``[0, 1]``.
If *None*, *norm* defaults to a *colors.Normalize* object which
initializes its scaling based on the first data processed.
cmap : str or :class:`~matplotlib.colors.Colormap` instance
The colormap used to map normalized data values to RGBA colors.
N<>arrayF) <0B>cbookZCallbackRegistry<72> callbacksSMr6r!<00> Normalize<7A>_A<5F>normr1Zcolorbar<61> update_dict)<03>selfr=r1r r r <00>__init__<5F>s

zScalarMappable.__init__FTc Cs<><00>y<|jdk<02>r<|jddkr<>|dkr*d}|jtjkrDt<03>|d<00>}|jdd<02>\}}tj||df|jd<07>}||dd<03>dd<03>dd<01>f<||dd<03>dd<03>df<n|jddkr<>|}ntd<08><01>|jjd k<02>r|r<>|<07><08>dks<>|<07> <09>d
kr<>td <0B><01>|<03>r8|d<00>
tj<04>}n4|jtjk<02>r*|<03>s8|<07>
tj <0B>d}ntd |j<00><01>|SWnt k
<EFBFBD>rTYnXt <0A>|<01>}|<04>rp|<00>|<01>}|j|||d <0A>}|S)a<>
Return a normalized rgba array corresponding to *x*.
In the normal case, *x* is a 1-D or 2-D sequence of scalars, and
the corresponding ndarray of rgba values will be returned,
based on the norm and colormap set for this ScalarMappable.
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 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 uint8, or it can be floating point with
values in the 0-1 range; otherwise a ValueError will be raised.
If it is a masked array, the mask will be ignored.
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 pre-existing 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 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).
<20>rNr<00><><00>)<02>shape<70>dtypezthird dimension must be 3 or 4r rz:Floating point image RGB values must be in the 0..1 range.z9Image RGB array must be uint8 or floating point; found %s)<02>alpha<68>bytes)<11>ndimrDrE<00>npZuint8<74>emptyr*<00>kind<6E>max<61>minZastypeZfloat32r)rZasarrayr=r1) r?r
rFrGr=<00>m<>nZxxZrgbar r r <00>to_rgba<62>s@  


zScalarMappable.to_rgbacCs||_d|jd<dS)zmSet the image array from numpy array *A*.
Parameters
----------
A : ndarray
Tr8N)r<r>)r?<00>Ar r r <00> set_array%szScalarMappable.set_arraycCs|jS)zReturn the array)r<)r?r r r <00> get_array/szScalarMappable.get_arraycCs|jS)zreturn the colormap)r1)r?r r r r63szScalarMappable.get_cmapcCs|jj|jjfS)z9return the min, max of the color limits for image scaling)r=<00>vmin<69>vmax)r?r r r <00>get_clim7szScalarMappable.get_climc Csf|dkr.y |\}}Wnttfk
r,YnX|dk rDt<02>|<01>|j_|dk rZt<02>|<02>|j_|<00><07>dS)a&
set the norm limits for image scaling; if *vmin* is a length2
sequence, interpret it as ``(vmin, vmax)`` which is used to
support setp
ACCEPTS: a length 2 sequence of floats; may be overridden in methods
that have ``vmin`` and ``vmax`` kwargs.
N)<08> TypeErrorr*r!Z_sanitize_extremar=rTrU<00>changed)r?rTrUr r r <00>set_clim;s  zScalarMappable.set_climcCsdS)z]
Returns
-------
alpha : float
Always returns 1.
g<00>?r )r?r r r <00> get_alphaOszScalarMappable.get_alphacCst|<01>}||_|<00><02>dS)z<>
set the colormap for luminance data
Parameters
----------
cmap : colormap or registered colormap name
N)r6r1rX)r?r1r r r <00>set_cmapYszScalarMappable.set_cmapcCs"|dkrt<00><01>}||_|<00><03>dS)aHSet the normalization instance.
Parameters
----------
norm : `.Normalize`
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;r=rX)r?r=r r r <00>set_normeszScalarMappable.set_normcCs,|jdkrtd<02><01>|j<02>|j<00>|<00><04>dS)zb
Autoscale the scalar limits on the norm instance using the
current array
Nz%You must first set_array for mappable)r<rWr=<00> autoscalerX)r?r r r r]xs
zScalarMappable.autoscalecCs,|jdkrtd<02><01>|j<02>|j<00>|<00><04>dS)z<>
Autoscale the scalar limits on the norm instance using the
current array, changing only limits that are None
Nz%You must first set_array for mappable)r<rWr=<00>autoscale_NonerX)r?r r r r^<00>s
zScalarMappable.autoscale_NonecCsd|j|<dS)zz
Add an entry to a dictionary of boolean flags
that are set to True when the mappable is changed.
FN)r>)r?<00>checkerr r r <00> add_checker<65>szScalarMappable.add_checkercCs|j|rd|j|<dSdS)zf
If mappable has changed since the last check,
return True; else return False
FT)r>)r?r_r r r <00> check_update<74>s

zScalarMappable.check_updatecCs2|j<00>d|<00>x|jD]}d|j|<qWd|_dS)z<>
Call this whenever the mappable is changed to notify all the
callbackSM listeners to the 'changed' signal
rXTN)r:<00>processr><00>stale)r?rr r r rX<00>s zScalarMappable.changed)NN)NFT)NN)<13>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__r@rPrRrSr6rVrYrZr[r\r]r^r`rarXr r r r r7<00>s 

F


 


r7)N)NNNN)NN)rgrZnumpyrIrZ
matplotlibr/Zmatplotlib.colorsr!Zmatplotlib.cbookr9Zmatplotlib._cmrZmatplotlib._cm_listedrZ cmaps_listedr.rrr r%r0ZLUTSIZE<5A>updaterr'<00>localsr3r6<00>objectr7r r r r <00><module>s.     




 
'