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

217 lines
22 KiB
Plaintext
Raw Normal View History

Ë
†RjÓGãó6dZddlmZddlmZddlmZddlmZ ddl
m Z ddl Z
Gdd «ZGd
d e«ZGd d
e«ZdZGdde«Zee¬«ZGdde«Zee¬«ZGdde«ZGdde«ZGdde«Zee¬«Zy)z
Defines classes for path effects. The path effects are supported in `.Text`,
`.Line2D` and `.Patch`.
.. seealso::
:ref:`patheffects_guide`
é)Ú RendererBase)Úcolors)Úpatches)Ú
transforms)ÚPathNcó,eZdZdZddZdZdZddZy) ÚAbstractPathEffectz
A base class for path effects.
Subclasses should override the ``draw_path`` method to add effect
functionality.
có||_y)
Parameters
----------
offset : (float, float), default: (0, 0)
The (x, y) offset to apply to the path, measured in points.
N)Ú_offset)ÚselfÚoffsets úY/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/patheffects.pyÚ__init__zAbstractPathEffect.__init__s ðˆ ócó€tj«jt|j|j
«ŽS)z(Apply the offset to the given transform.)Ú mtransformsÚAffine2DÚ translateÚmapÚpoints_to_pixelsr )r Úrenderers rÚ_offset_transformz$AbstractPathEffect._offset_transform"s4à/Œ{×
×*¨D¯L©LÓ
 ;rcó|j«}|jdd«}|r|jdi|¤Ž|j«D]6\}}t |d|zd«}t |«st
d|«||«Œ8|S)
Update the given GraphicsContext with the given dict of properties.
The keys in the dictionary are used to identify the appropriate
``set_`` method on the *gc*.
ÚdashesNÚset_zUnknown property ©)ÚcopyÚpopÚ
set_dashesÚitemsÚgetattrÚcallableÚAttributeError)r ÚgcÚ new_gc_dictrÚ
set_methods rÚ
_update_gczAbstractPathEffect._update_gc'sð"×(ˆ à ¨4ÓÙ Ø ˆBM‰MÑ #˜FÒ × ‰DˆAˆ   V¨a¡Z°Ó6ˆ˜$Ð'8¸¸Ð%<Ó q ð
ˆ rNcóbt|t«r |j}|j||||«S)
Derived should override this method. The arguments are the same
as :meth:`matplotlib.backend_bases.RendererBase.draw_path`
except the first argument is a renderer.
)Ú
isinstanceÚPathEffectRendererÚ _rendererÚ draw_path)r rr$ÚtpathÚaffineÚrgbFaces rr.zAbstractPathEffect.draw_path;s1ô hÔ 2Ô ×)ˆ×! " e¨V°WÓ=r))çr2©N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrr)r.rrrr r sñóò
ô( >rr cóTeZdZdZdZdZdZd
dZˆfdZˆfdZ d
dZ
d „Z ˆxZ S) r,aw
Implements a Renderer which contains another renderer.
This proxy then intercepts draw calls, calling the appropriate
:class:`AbstractPathEffect` draw method.
.. note::
Not all methods have been overridden on this RendererBase subclass.
It may be necessary to add further methods to extend the PathEffects
capabilities further.
có ||_||_y)
Parameters
----------
path_effects : iterable of :class:`AbstractPathEffect`
The path effects which this renderer represents.
renderer : `~matplotlib.backend_bases.RendererBase` subclass
N)Ú
_path_effectsr-)r Ú path_effectsrs rrzPathEffectRenderer.__init__Tsð*ˆÔØrcó:|j||j«Sr3)Ú __class__r-)r r;s rÚcopy_with_path_effectz(PathEffectRenderer.copy_with_path_effect`sØ~‰~˜l¨D¯N©NÓ;rcób|dvrt|j|«Stj||«S)N)ÚflipyÚget_canvas_width_heightÚnew_gcrÚ
_text2pathÚheightÚwidth)r!r-ÚobjectÚ__getattribute__)r Únames rrGz#PathEffectRenderer.__getattribute__cs5Ø ðIñ Iä˜4Ÿ>™>¨4Ó ×*¨4°Ó 6rcód|jD]!}|j|j||||«Œ#yr3)r:r.r-)r r$r/r0r1Ú path_effects rr.zPathEffectRenderer.draw_pathjs4Ø× +ˆ × ! $§.¡.°"°e¸VØ")õ
 +rcóÚt|j«dk(rt‰ | ||||g|¢­i|¤ŽS|jD]-}|j |g«}|j||||g|¢­i|¤ŽŒ/y©)Úlenr:ÚsuperÚ draw_markersr>)
r r$Ú marker_pathÚ marker_transÚpathÚargsÚkwargsrJrr=s
€rrPzPathEffectRenderer.draw_markersos—ø€ô
ˆt× "  ¨K¸Àtð9Ø)-ò9Ø17ñ
 × 3ˆKØ×1°;°-Ó@ˆ
"ˆH× ! " k°<Àð
3Ø#'ò
3Ø+1ó
 3rcóÖt|j«dk(rt| |||g|¢­i|¤ŽS|jD],}|j |g«}|j|||g|¢­i|¤ŽŒ.yrL)rNr:rOÚdraw_path_collectionr>) r r$Úmaster_transformÚpathsrTrUrJrr=s €rrWz'PathEffectRenderer.draw_path_collections™ø€ô
ˆt× "  Ð4DÀeðAØ15òAØ9?ñAð
Að × ;ˆKØ×1°;°-Ó@ˆ
*ˆH× )¨"Ð.>Àð
;Ø+/ò
;Ø39ó
 ;rcó:|jj||«Sr3)r-Ú
open_group)r Úgids rr[zPathEffectRenderer.open_group“sØ~‰~רCÓ0rcó8|jj|«Sr3)r-Ú close_group)r r\s rr_zPathEffectRenderer.close_groupsØ~‰~×)¨!Ó,rr3)
r4r5r6r7rr>rGr.rPrWr[r_Ú
__classcell__©r=s@rr,r,Gs0ø„ñ
ò

3ô$;ó$-rr,cóeZdZdZy)ÚNormalzŽ
The "identity" PathEffect.
The Normal PathEffect's sole purpose is to draw the original artist with
no special path effect.
N)r4r5r6r7rrrrcrcšsòrrccóGdd|«}d|j|_d|j|_d|jd|jd|jd|_|jj|j_|S)zO
Create a PathEffect class combining *effect_class* and a normal draw.
cóeZdZˆfdZˆxZS)ú)_subclass_with_normal.<locals>.withEffectcóTt||||||«|j||||«yr3)rOr.)r rr$r/r0r1r=s €rr.z3_subclass_with_normal.<locals>.withEffect.draw_path©s,ø€Ü ‰GÑ ˜h¨¨E°6¸7Ô × Ñ ˜r 5¨&°'Õ :r)r4r5r6r.r`ras@rÚ
withEffectrf¨s
ø„÷ ;rrhÚwithz*
A shortcut PathEffect for applying `.z` and then
drawing the original Artist.
With this class you can use ::
artist.set_path_effects([patheffects.withzM()])
as a shortcut for ::
artist.set_path_effects([patheffects.z@(),
patheffects.Normal()])
)r4r6r7r.)Ú effect_classrhs rÚ_subclass_with_normalrk£ô
;
! ×!6Ñ!6Ð 7Ð8€JÔØ $ \×%:Ñ%:Ð$;Ð<€JÔð*Ø*6×*?Ñ*?Ð)@ðA
3?×2GÑ2GÐ1HðI/;×.CÑ.CÐ-DðEð €JÔð$0×#9Ñ#9×#AÑ#A€J×ÑÔ Ø Ðrcó*eZdZdZdˆfd„ ZdZˆxZS)ÚStrokez0A line based PathEffect which re-draws a stroke.c ó2t||«||_y)
The path will be stroked with its gc updated with the given
keyword arguments, i.e., the keyword arguments should be valid
gc parameter values.
N)rOrÚ_gc©r r
rUr=s €rrzStroke.__init__Äsø€ô Ñ˜Ô Øˆrcóê|j«}|j|«|j||j«}|j ||||j |«z|«|j
«y)úDraw the path with updated gc.N)rBÚcopy_propertiesr)ror.rÚrestore)r rr$r/r0r1Úgc0s rr.zStroke.draw_pathÍsaào‰oÓˆØ ×јBÔØo‰o˜c 4§8¡8ÓØ×ÑØ ˜ ×!7Ñ!7¸Ó!AÑAÀ7ô Là
r©©rr©r4r5r6r7rr.r`ras@rrmrmÁsø„Ùörrm)rjcó0eZdZdZ dˆfd„ ZdZˆxZS)ÚSimplePatchShadowz#A simple shadow via a filled patch.c óžt||«|||_ntj|«|_|d}||_||_||_y)aR
Parameters
----------
offset : (float, float), default: (2, -2)
The (x, y) offset of the shadow in points.
shadow_rgbFace : :mpltype:`color`
The shadow color.
alpha : float, default: 0.3
The alpha transparency of the created shadow patch.
rho : float, default: 0.3
A scale factor to apply to the rgbFace color if *shadow_rgbFace*
is not specified.
**kwargs
Extra keywords are stored and passed through to
:meth:`AbstractPathEffect._update_gc`.
Nç333333Ó?)rOrÚ_shadow_rgbFaceÚmcolorsÚto_rgbaÚ_alphaÚ_rhoro)r r
Úshadow_rgbFaceÚalphaÚrhorUr=s €rrzSimplePatchShadow.__init__ÝsRø€ô( Ñ˜Ô à Ð !Ø#1ˆDÕ ä#*§?¡?°>Ó#BˆDÔ à ˆ=؈EàˆŒ ؈Œ ðˆrcó|j«}|j|«|j€:|xsddd\}}} ||jz||jz| |jzf}
n |j}
|j d«|j |j «|jd«|j||j«}|j||||j|«z|
«|j«y)ú
Overrides the standard draw_path to add the shadow offset and
necessary color changes for the shadow.
çð?rˆrˆéÚnoner)
rBrsr}rÚset_foregroundÚ set_alphar€Ú
set_linewidthr)ror.rrt© r rr$r/r0r1ruÚbrs rr.zSimplePatchShadow.draw_pathð
o‰oÓˆØ ×јBÔà × Ñ Ð Ò. ,°°Ð3‰GˆAˆq $§)¡)™m¨Q°·±©]¸AÀÇ Á ¹MÐJ‰Nà1ˆ ×ј
d—k ×јào‰o˜c 4§8¡8ÓØ×ÑØ ˜ ×!7Ñ!7¸Ó!AÑ ô ð
r)©ééþÿÿÿNNr|rxras@rrzrzÚsø„Ù%Ø,0Øõ"öHrrzcó.eZdZdZ dˆfd„ ZdZˆxZS)ÚSimpleLineShadowzA simple shadow via a line.c ó–t||«|||_ntj|«|_||_||_||_y)
Parameters
----------
offset : (float, float), default: (2, -2)
The (x, y) offset to apply to the path, in points.
shadow_color : :mpltype:`color`, default: 'black'
The shadow color.
A value of ``None`` takes the original artist's color
with a scale factor of *rho*.
alpha : float, default: 0.3
The alpha transparency of the created shadow patch.
rho : float, default: 0.3
A scale factor to apply to the rgbFace color if *shadow_color*
is ``None``.
**kwargs
Extra keywords are stored and passed through to
:meth:`AbstractPathEffect._update_gc`.
N)rOrÚ
_shadow_colorr~rr€rro)r r
Ú shadow_colorrƒr„rUr=s €rrzSimpleLineShadow.__init__!sFø€ô( Ñ˜Ô Ø Ð Ø!-ˆDÕ ä!(§¡°Ó!>ˆDÔ ØˆŒ ؈Œ àˆrcó|j«}|j|«|j€H|j«xsddd\}}} ||jz||jz| |jzf}
n |j}
|j |
«|j
|j«|j||j«}|j||||j|«z«|j«y)r†Nr‡r‰)
rBrsr˜Úget_foregroundrrr€r)ror.rrts rr.zSimpleLineShadow.draw_path?ð
o‰oÓˆØ ×јBÔà × Ñ Ð ×;¨|¸R¸@‰GˆAˆq $§)¡)™m¨Q°·±©]¸AÀÇ Á ¹MÐJ‰Nà/ˆNà ×ј>Ô
d—ko‰o˜c 4§8¡8ÓØ×ÑØ ˜ ×!7Ñ!7¸Ó!AÑ Cà
r)rr&r|r|rxras@rrrsø„Ù%Ø25õö<rrcó*eZdZdZdˆfd„ ZdZˆxZS)ÚPathPatchEffectza
Draws a `.PathPatch` instance whose Path comes from the original
PathEffect artist.
c ó\t||¬«tjgfi|¤Ž|_y)
Parameters
----------
offset : (float, float), default: (0, 0)
The (x, y) offset to apply to the path, in points.
**kwargs
All keyword arguments are passed through to the
:class:`~matplotlib.patches.PathPatch` constructor. The
properties which cannot be overridden are "path", "clip_box"
"transform" and "clip_path".
)r
N)rOrÚmpatchesÚ PathPatchÚpatchrps €rrzPathPatchEffect.__init__]s,ø€ô Ñ ÐÔ×Ñ5¨fÑ5ˆ
rcó’||j_|jj||j|«z«|jj |j ««|j
«}|r3|jj
«|jj|Ž|jj|«yr3) r¡Ú_pathÚ
set_transformrÚ set_clip_boxÚget_clip_rectangleÚ
get_clip_pathÚ
set_clip_pathÚdraw)r rr$r/r0r1Ú clip_paths rr.zPathPatchEffect.draw_pathlsØ ˆ
ÔØ
× Ñ  ¨$×*@Ñ*@ÀÓ*JÑ!JÔ
×Ñ × 5Ñ 5Ó 7Ô×&ˆ Ù ˜Ÿ× $ˆDJ‰J× $  
˜Õ!rrvrxras@rrrWsø„ñõ
"rrcóReZdZdZdddej
d«fˆfd„ ZdZˆxZS)Ú TickedStrokea
A line-based PathEffect which draws a path with a ticked style.
This line style is frequently used to represent constraints in
optimization. The ticks may be used to indicate that one side
of the line is invalid or to represent a closed boundary of a
domain (i.e. a wall or the edge of a pipe).
The spacing, length, and angle of ticks can be controlled.
This line style is sometimes referred to as a hatched line.
See also the :doc:`/gallery/misc/tickedstroke_demo` example.