rL iȄ ^dZddlZddlZddlZddlmZmZddlZddlm Z ddl m Z ddl m Z ddlZddlZddlmZmZmZmZmZmZmZmZdd lmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%dd l&m'Z'dd l(m)Z)m*Z*ejVejXd gd gdgdgdgdGddejZZ.Gdde.Z/Gdde.Z0Gdde.Z1Gdde.Z2Gdde2Z3Gdde.Z4Gd d!e.Z5Gd"d#e.Z6Gd$d%e4Z7ejVjqd&jsejte7jvxsd'jyd(d)Gd*d+e1Z=Gd,d-e.Z>Gd.d/e.Z?Gd0d1e>Z@Gd2d3e>ZAdGd4ZBdHd5ZCGd6d7ZDdIdd8d9ZEejVGd:d;eDZFejVGd<d=eDZGd>ZHejVGd?d@eDZIGdAdBe.ZJGdCdDe.ZKGdEdFeKZLy)Jz> Patches are `.Artist`\s with a face color and an edge color. N)NumberReal)SimpleNamespace) namedtuple)Affine2D)_apiartistcbookcolors _docstringhatchlines transforms)NonIntersectingPathException get_cos_singet_intersection get_parallels inside_circlemake_wedged_bezier2)split_bezier_intersecting_with_closedpathsplit_path_inout)Path) JoinStyleCapStyleaaecfclslw) antialiased edgecolor facecolor linestyle linewidthc eZdZdZdZdZddddddddddd fd ZdZd Zd/d Z d/d Z d/d Z fd Z dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZfdZdZdZd Zd!Z e!e eZ"e#jHd"Z%d#Z&e#jHd$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-e.j^d+Z0d,Z1d/d-Z2d.Z3xZ4S)0Patchz A patch is a 2D artist with a face color and an edge color. If any of *edgecolor*, *facecolor*, *linewidth*, or *antialiased* are *None*, they default to their rc params setting. rFNT) r"r#colorr%r$r!rfillcapstyle joinstylec  t ||d}| tj} | tj } t jtjd|_ tjd|_ t||_ |+||tjd|j!|n"|j#||j%|d|_d|_d|_|j-||j/||j1||j3||j5| |j7| t9| r|j;| yy)zW The following kwarg properties are supported %(Patch:kwdoc)s Nsolidz hatch.colorzhatch.linewidthzQSetting the 'color' property will override the edgecolor or facecolor properties.r)rN)super__init__rbuttrmiterr to_rgbamplrcParams _hatch_color_hatch_linewidthbool_fillr warn_external set_color set_edgecolor set_facecolor _linewidth_unscaled_dash_pattern _dash_pattern set_linestyle set_linewidthset_antialiased set_hatch set_capstyle set_joinstylelen_internal_update) selfr"r#r(r%r$r!rr)r*r+kwargs __class__s X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/matplotlib/patches.pyr/zPatch.__init__0sA"   I  }}H  !I"NN3<< +FG # -> ?$Z  $ (=""=> NN5 !   y )   y )&/#& 9% 9% [) u (# 9% v;  ! !& ) c|j}|j}|j|}t|r|dSgS)u Return a copy of the vertices used in this patch. If the patch contains Bézier curves, the curves will be interpolated by line segments. To access the curves as curves, use `get_path`. r) get_transformget_path to_polygonsrF)rHtranspathpolygonss rK get_vertszPatch.get_vertsesC""$}}##E* x=A;  rLc||St|jtr|j}|S|jddk(rd}|S|j }|S)Nr) isinstance_pickerr get_edgecolor get_linewidth)rHradius_radiuss rK_process_radiuszPatch._process_radiusssd  M dllF +llG  !!#A&!+,,.rLcjrdifSjjj}|jj}t j |tjk(\}|dd}ttt j||t j||}njg}tfd|D}|ifS)aY Test whether the mouse event occurred in the patch. Parameters ---------- mouseevent : `~matplotlib.backend_bases.MouseEvent` Where the user clicked. radius : float, optional Additional margin on the patch in target coordinates of `.Patch.get_transform`. See `.Path.contains_point` for further details. If `None`, the default value depends on the state of the object: - If `.Artist.get_picker` is a number, the default is that value. This is so that picking works as expected. - Otherwise if the edge color has a non-zero alpha, the default is half of the linewidth. This is so that all the colored pixels are "in" the patch. - Finally, if the edge has 0 alpha, the default is 0. This is so that patches without a stroked edge do not have points outside of the filled region report as "in" due to an invisible edge. Returns ------- (bool, empty dict) FNrc3K|];}|jjjfj=ywN)contains_pointxyrN).0subpath mouseeventr[rHs rK z!Patch.contains..sD%  " "z||,d.@.@.BF L%sAA) _different_canvasr]rOcodesverticesnpwhererMOVETOmapsplitany)rHrfr[rirjidxssubpathsinsides``` rKcontainszPatch.containss>  ! !* -"9 %%f- %%  }}//HHHUdkk12ED8Dbhhx.0EGH (H%$%%rzrLc|j|}|jj||j|S)a Return whether the given point is inside the patch. Parameters ---------- point : (float, float) The point (x, y) to check, in target coordinates of ``.Patch.get_transform()``. These are display coordinates for patches that are added to a figure or Axes. radius : float, optional Additional margin on the patch in target coordinates of `.Patch.get_transform`. See `.Path.contains_point` for further details. If `None`, the default value depends on the state of the object: - If `.Artist.get_picker` is a number, the default is that value. This is so that picking works as expected. - Otherwise if the edge color has a non-zero alpha, the default is half of the linewidth. This is so that all the colored pixels are "in" the patch. - Finally, if the edge has 0 alpha, the default is 0. This is so that patches without a stroked edge do not have points outside of the filled region report as "in" due to an invisible edge. Returns ------- bool Notes ----- The proper use of this method depends on the transform of the patch. Isolated patches do not have a transform. In this case, the patch creation coordinates and the point coordinates match. The following example checks that the center of a circle is within the circle >>> center = 0, 0 >>> c = Circle(center, radius=1) >>> c.contains_point(center) True The convention of checking against the transformed patch stems from the fact that this method is predominantly used to check if display coordinates (e.g. from mouse events) are within the patch. If you want to do the above check with data coordinates, you have to properly transform them first: >>> center = 0, 0 >>> c = Circle(center, radius=3) >>> plt.gca().add_patch(c) >>> transformed_interior_point = c.get_data_transform().transform((0, 2)) >>> c.contains_point(transformed_interior_point) True )r]rOrarN)rHpointr[s rKrazPatch.contains_points?r%%f-}}--e.2.@.@.B.46 6rLc|j|}|jj||j|S)a Return whether the given points are inside the patch. Parameters ---------- points : (N, 2) array The points to check, in target coordinates of ``self.get_transform()``. These are display coordinates for patches that are added to a figure or Axes. Columns contain x and y values. radius : float, optional Additional margin on the patch in target coordinates of `.Patch.get_transform`. See `.Path.contains_point` for further details. If `None`, the default value depends on the state of the object: - If `.Artist.get_picker` is a number, the default is that value. This is so that picking works as expected. - Otherwise if the edge color has a non-zero alpha, the default is half of the linewidth. This is so that all the colored pixels are "in" the patch. - Finally, if the edge has 0 alpha, the default is 0. This is so that patches without a stroked edge do not have points outside of the filled region report as "in" due to an invisible edge. Returns ------- length-N bool array Notes ----- The proper use of this method depends on the transform of the patch. See the notes on `.Patch.contains_point`. )r]rOcontains_pointsrN)rHpointsr[s rKrxzPatch.contains_pointss?H%%f-}}..v/3/A/A/C/57 7rLct|||j|_|j|_|j|_|j |_|j |_|j|_|j|_|j|_ |j|j|j|j|j|_yr`)r. update_from _edgecolor _facecolor_original_edgecolor_original_facecolorr8_hatchr5r>rAr= set_transformget_data_transformis_transform_set _transformSet)rHotherrJs rKr{zPatch.update_froms E" ****#(#<#< #(#<#< [[ ll !..&+&B&B# 5++, 53356#335rLc\|jj|jS)zU Return the `Patch`'s axis-aligned extents as a `~.transforms.Bbox`. rO get_extentsrNrHs rKrzPatch.get_extents-s$}}**4+=+=+?@@rLcb|jtjj|zS)z;Return the `~.transforms.Transform` applied to the `Patch`.)get_patch_transformr ArtistrNrs rKrNzPatch.get_transform3s%'')FMM,G,G,MMMrLc@tjj|S)zo Return the `~.transforms.Transform` mapping data coordinates to physical coordinates. )r rrNrs rKrzPatch.get_data_transform7s }}**400rLc*tjS)aS Return the `~.transforms.Transform` instance mapping patch coordinates to data coordinates. For example, one may define a patch of a circle which represents a radius of 5 by providing coordinates for a unit circle, and a transform which scales the coordinates (the patch coordinate) by 5. )rIdentityTransformrs rKrzPatch.get_patch_transform>s++--rLc|jS)z0Return whether antialiasing is used for drawing.) _antialiasedrs rKget_antialiasedzPatch.get_antialiasedIs   rLc|jS)zReturn the edge color.)r|rs rKrYzPatch.get_edgecolorM rLc|jS)zReturn the face color.)r}rs rK get_facecolorzPatch.get_facecolorQrrLc|jS)z Return the line width in points.)r=rs rKrZzPatch.get_linewidthUrrLc|jS)zReturn the linestyle.) _linestylers rK get_linestylezPatch.get_linestyleYrrLcJ|tjd}||_d|_y)z| Set whether to use antialiased rendering. Parameters ---------- aa : bool or None Nzpatch.antialiasedT)r3r4rstale)rHrs rKrBzPatch.set_antialiased]s' :12B rLcd}|Ctjds|jr |jrtjd}nd}d}t j ||j |_|r|j|_d|_ y)NTzpatch.force_edgecolorzpatch.edgecolornoneF) r3r4r8 _edge_defaultr r2_alphar|r5r)rHr(set_hatch_colors rK_set_edgecolorzPatch._set_edgecolorjsm = 45 d&8&8 %67"' .. <  $D  rLc4||_|j|y)z{ Set the patch edge color. Parameters ---------- color : :mpltype:`color` or None N)r~rrHr(s rKr;zPatch.set_edgecolory$)  E"rLc|tjd}|jr |jnd}t j |||_d|_y)Nzpatch.facecolorrT)r3r4r8rr r2r}r)rHr(alphas rK_set_facecolorzPatch._set_facecolors@ =LL!23E#zz q ..6 rLc4||_|j|y)z{ Set the patch face color. Parameters ---------- color : :mpltype:`color` or None N)rrrs rKr<zPatch.set_facecolorrrLcH|j||j|y)a Set both the edgecolor and the facecolor. Parameters ---------- c : :mpltype:`color` See Also -------- Patch.set_facecolor, Patch.set_edgecolor For setting the edge or face color individually. N)r<r;)rHcs rKr:zPatch.set_colors  1 1rLct|||j|j|j |j yr`)r. set_alpharrrr~)rHrrJs rKrzPatch.set_alphas8 %  D445 D445rLc|tjd}t||_t j g|j ||_d|_y)zu Set the patch linewidth in points. Parameters ---------- w : float or None Nzpatch.linewidthT) r3r4floatr=mlines _scale_dashesr>r?rrHws rKrAzPatch.set_linewidthsS 9 ./A(#11-  ( (-*+- rLc|d}|dvrd}||_tj||_tjg|j|j |_d|_y)a Set the patch linestyle. ========================================== ================= linestyle description ========================================== ================= ``'-'`` or ``'solid'`` solid line ``'--'`` or ``'dashed'`` dashed line ``'-.'`` or ``'dashdot'`` dash-dotted line ``':'`` or ``'dotted'`` dotted line ``'none'``, ``'None'``, ``' '``, or ``''`` draw nothing ========================================== ================= Alternatively a dash tuple of the following form can be provided:: (offset, onoffseq) where ``onoffseq`` is an even length tuple of on and off ink in points. Parameters ---------- ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} The line style. Nr-) rNoneT)rr_get_dash_patternr>rr=r?r)rHrs rKr@zPatch.set_linestylesj2 :B " "B&,&>&>r&B##11;  ( (;*.//; rLct||_|j|j|j |j d|_y)zh Set whether to fill the patch. Parameters ---------- b : bool TN)r7r8rrrr~rrHbs rKset_fillzPatch.set_fills>!W  D445 D445 rLc|jS)z#Return whether the patch is filled.)r8rs rKget_fillzPatch.get_fill zzrLc6t|}||_d|_y)z Set the `.CapStyle`. The default capstyle is 'round' for `.FancyArrowPatch` and 'butt' for all other patches. Parameters ---------- s : `.CapStyle` or %(CapStyle)s TN)r _capstyler)rHscss rKrDzPatch.set_capstylesa[ rLc.|jjS)zReturn the capstyle.)rnamers rK get_capstylezPatch.get_capstyles~~"""rLc6t|}||_d|_y)z Set the `.JoinStyle`. The default joinstyle is 'round' for `.FancyArrowPatch` and 'miter' for all other patches. Parameters ---------- s : `.JoinStyle` or %(JoinStyle)s TN)r _joinstyler)rHrjss rKrEzPatch.set_joinstyle sq\ rLc.|jjS)zReturn the joinstyle.)rrrs rK get_joinstylezPatch.get_joinstyles###rLcJtj|||_d|_y)a Set the hatching pattern. *hatch* can be one of:: / - diagonal hatching \ - back diagonal | - vertical - - horizontal + - crossed x - crossed diagonal o - small circle O - large circle . - dots * - stars Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern. Parameters ---------- hatch : {'/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} TN)mhatch_validate_hatch_patternrr)rHrs rKrCzPatch.set_hatchs 4 &&u-  rLc|jS)zReturn the hatching pattern.)rrs rK get_hatchzPatch.get_hatch; {{rLc||_y)zSet the hatch linewidth.Nr6)rHr s rKset_hatch_linewidthzPatch.set_hatch_linewidth?s "rLc|jS)zReturn the hatch linewidth.rrs rKget_hatch_linewidthzPatch.get_hatch_linewidthC$$$rLc|jd|j|j}|j|jd|j }|jddk(s|j dk(rd}|j||j|j|j|j|j|j|j|j|j!||j#|j$|j'|j)|j+|j,|j.rQ|j1|j.|j3|j4|j7|j8|j;|j<|j;|j?rddl m!}||j?|}|D]}|jD|g||jG|jIdd |_%y) aJ ``draw()`` helper factored out for sharing with `FancyArrowPatch`. Configure *renderer* and the associated graphics context *gc* from the artist properties, then repeatedly call ``renderer.draw_path(gc, *draw_path_args)`` for each tuple *draw_path_args* in *draw_path_args_list*. patchT)isRGBArVrrN)PathEffectRendererF)& open_groupget_gidnew_gcset_foregroundr|r=rrA set_dashesr?rDrrErrBr _set_gc_clipset_url_urlset_snapget_snaprrrrCrr5rr6get_sketch_paramsset_sketch_paramsget_path_effectsmatplotlib.patheffectsr draw_pathrestore close_groupr)rHrendererdraw_path_args_listgcr rdraw_path_argss rK"_draw_paths_with_artist_propertiesz(Patch._draw_paths_with_artist_propertiesGs GT\\^4 __  $//$7 __ ??1  "doo&?B  t))* ' ) 4,,- " 499 DMMO$ T[[! ;; LL %   t00 1  " "4#8#8 9  ! ! # / B $"8"8": ;  " A)$*?*?*A8LH1 4N H  r 3N 3 4 W% rLc |jsy|j}|j}|j|}|j }|j ||||j dr |j ndfgy)NrV) get_visiblerOrNtransform_path_non_affine get_affinerr})rHrrR transformtpathaffines rKdrawz Patch.drawys! }}&&( 33D9%%' // V"&!3doo ? @ ArLctd)zReturn the path of this patch.Derived must overrideNotImplementedErrorrs rKrOzPatch.get_paths!"9::rLc\|jj|jSr`r)rHrs rKget_window_extentzPatch.get_window_extents"}}**4+=+=+?@@rLcZ|j|d}|j|d}||fS)z)Convert x and y units for a tuple (x, y).rr)convert_xunitsconvert_yunits)rHxyrbrcs rK_convert_xy_unitszPatch._convert_xy_unitss3   1 &   1 &!t rLr`)5__name__ __module__ __qualname____doc__zorderrr/rTr]rtrarxr{rrNrrrrYrrZrrBrr;rr<r:rrAr@rrpropertyr)r interpdrDrrErrCrrrrr allow_rasterizationrrOrr __classcell__rJs@rKr'r'sT FM !3*j  2h<6|'7R6&A N1 .!   # # 6 !F  Hh 'D  #  $<#%0d A A ;ArLr'cdeZdZdZej ddfd ZdZdZdZ fdZ xZ S) Shadowc"d|jdS)NzShadow())rrs rK__str__zShadow.__str__s A&&rLgffffff?)shadec $t|||_||c|_|_t j |_|j|jd|cxkrdkstdtdd|z tjtj|jjz}|j||dtj |jj"tj$ d|y)a Create a shadow of the given *patch*. By default, the shadow will have the same face color as the *patch*, but darkened. The darkness can be controlled by *shade*. Parameters ---------- patch : `~matplotlib.patches.Patch` The patch to create the shadow for. ox, oy : float The shift of the shadow in data coordinates, scaled by a factor of dpi/72. shade : float, default: 0.7 How the darkness of the shadow relates to the original color. If 1, the shadow is black, if 0, the shadow has the same color as the *patch*. .. versionadded:: 3.8 **kwargs Properties of the shadow patch. Supported keys are: %(Patch:kwdoc)s rrzshade must be between 0 and 1.?)r#r"rr N)r.r/r_ox_oyrr_shadow_transformr{ ValueErrorrkasarrayr to_rgbrupdate nextafterr inf)rHroxoyrrIr(rJs rKr/zShadow.__init__s4  $(!+!4!4!6 $EQ=> >=> >Ubjjtzz7O7O7Q)RSS %ec!||DJJ,=,=wG rLc|j|j}|j|j}|jj j ||yr`)points_to_pixelsrrrclear translate)rHrr r!s rK_update_transformzShadow._update_transformsI  & &txx 0  & &txx 0 $$&00R8rLc6|jjSr`)rrOrs rKrOzShadow.get_pathszz""$$rLcP|jj|jzSr`)rrrrs rKrzShadow.get_patch_transforms zz--/$2H2HHHrLcF|j|t| |yr`)r&r.rrHrrJs rKrz Shadow.draws x(  XrL) rrrrr r r/r&rOrrr rs@rKrrs@'/2% % N9 %IrLrceZdZdZdZej dddfd ZdZdZ d Z e d Z e jd Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZe eeZxZS) Rectanglea A rectangle defined via an anchor point *xy* and its *width* and *height*. The rectangle extends from ``xy[0]`` to ``xy[0] + width`` in x-direction and from ``xy[1]`` to ``xy[1] + height`` in y-direction. :: : +------------------+ : | | : height | : | | : (xy)---- width -----+ One may picture *xy* as the bottom left corner, but which corner *xy* is actually depends on the direction of the axis and the sign of *width* and *height*; e.g. *xy* would be the bottom right corner if the x-axis was inverted or if *width* was negative. c|j|j|j|j|jf}d}||zS)Nz5Rectangle(xy=(%g, %g), width=%g, height=%g, angle=%g))_x0_y0_width_heightanglerHparsfmts rKrzRectangle.__str__s5xx4;; djjHETzrLr)r2rotation_pointc t|di||d|_|d|_||_||_t ||_||_d|_ |jy)a Parameters ---------- xy : (float, float) The anchor point. width : float Rectangle width. height : float Rectangle height. angle : float, default: 0 Rotation in degrees anti-clockwise about the rotation point. rotation_point : {'xy', 'center', (number, number)}, default: 'xy' If ``'xy'``, rotate around the anchor point. If ``'center'`` rotate around the center. If 2-tuple of number, rotate around this coordinate. Other Parameters ---------------- **kwargs : `~matplotlib.patches.Patch` properties %(Patch:kwdoc)s rr?N) r.r/r.r/r0r1rr2r7_aspect_ratio_correction_convert_units)rHrwidthheightr2r7rIrJs rKr/zRectangle.__init__sb0 "6"a5a5  5\ ,),% rLc*tjS)z%Return the vertices of the rectangle.)runit_rectanglers rKrOzRectangle.get_paths""$$rLc|j|j}|j|j}|j|j|jz}|j|j|j z}||||fS)z Convert bounds of the rectangle.)rr.rr/r0r1)rHx0y0x1y1s rKr<zRectangle._convert_unitssr   *   *  DKK!7 8  DLL!8 92r2~rLc|j}|jdk(rW|j|jz |j|j z }}|j|dz z|j |dz zf}n4|jdk(r|j|j f}n |j}t j|t jj|d |d jd|jj|jjdd|jz j|zS)Ncenter@rrr)get_bboxr7rDrBrErCrBboxTransformTorr%scaler; rotate_degr2)rHbboxr=r>r7s rKrzRectangle.get_patch_transform s }}   ( * GGdgg-tww/@6E!WWurz1477Vb[3HHN  D (!WWdgg-N!00N))$/*%%'N1--q0A/ABq$778DJJ'q!d;;;<N ,, ,rLc|jS)z The rotation point of the patch.)_rotation_pointrs rKr7zRectangle.rotation_point5s###rLc|dvsDt|trReturn the left and bottom coords of the rectangle as a tuple.)r.r/rs rKget_xyzRectangle.get_xyMsxx!!rLcD|jjgdS)zc Return the corners of the rectangle, moving anti-clockwise from (x0, y0). )rrrrrrrrrrrs rK get_cornerszRectangle.get_cornersQs# '')33 ,. .rLc@|jjdS)z#Return the centre of the rectangle.)rrr`rs rK get_centerzRectangle.get_centerYs'')33J??rLc|jSz"Return the width of the rectangle.r0rs rK get_widthzRectangle.get_width]rrLc|jSz#Return the height of the rectangle.r1rs rK get_heightzRectangle.get_heighta ||rLc|jS)z"Get the rotation angle in degrees.r2rs rK get_anglezRectangle.get_angleerrLc ||_d|_y)z)Set the left coordinate of the rectangle.TN)r.rrHrbs rKset_xzRectangle.set_xi rLc ||_d|_y)z+Set the bottom coordinate of the rectangle.TN)r/rrHrcs rKset_yzRectangle.set_ynrsrLc ||_d|_y)zs Set the rotation angle in degrees. The rotation is performed anti-clockwise around *xy*. TN)r2rrHr2s rK set_anglezRectangle.set_angless   rLc0|\|_|_d|_y)z Set the left and bottom coordinates of the rectangle. Parameters ---------- xy : (float, float) TN)r.r/rrHrs rKset_xyzRectangle.set_xy|s $( rLc ||_d|_y)zSet the width of the rectangle.TNr0rrs rK set_widthzRectangle.set_widths  rLc ||_d|_y)z Set the height of the rectangle.TNr1rrHhs rK set_heightzRectangle.set_heights  rLct|dk(r |d\}}}}n|\}}}}||_||_||_||_d|_y)a@ Set the bounds of the rectangle as *left*, *bottom*, *width*, *height*. The values may be passed as separate parameters or as a tuple:: set_bounds(left, bottom, width, height) set_bounds((left, bottom, width, height)) .. ACCEPTS: (left, bottom, width, height) rrTN)rFr.r/r0r1rrHargslrrrs rK set_boundszRectangle.set_boundssP t9>aJAq!QJAq!Q   rLcVtjj|jSzReturn the `.Bbox`.)rBbox from_extentsr<rs rKrIzRectangle.get_bboxs ++T-@-@-BCCrL) rrrrrr r r/rOr<rr r7setterrUrXrZrarcrgrkrorrrvryr|rrrrIrr rs@rKr,r,s$ 4%%N%,*$$DD".@     *D && !BrLr,cZeZdZdZdZej dddfd ZdZdZ xZ S) RegularPolygonzA regular polygon patch.cd}||jd|jd|j|j|jfzS)Nz7RegularPolygon((%g, %g), %d, radius=%g, orientation=%g)rr)r numverticesr[ orientationrHrs rKrzRegularPolygon.__str__sD EDGGAJ D,<,.>-?rCD D ()BHHQdnn,M+NuHHT\\* >> % $..1 1I22I:> DJD$ $++d462A6A $,,tD115A~~%NNAbqE1af#56$$)NNT^^$4a$..9I#JK$$)yyT!:A>ttDNNAq2w<0NNDIq$r($(!HdDI$?@!!?@@:-__aV,__aV, LL  LL$++$++B )BB C' D("../1FG rLcjtdd}||j|j|jS)z:Get `.StepPatch` values, edges and baseline as namedtuple. StairDatazvalues edges baseline)rrrr)rHrs rKget_datazStepPatch.get_dataKs*{,CD t{{DNNCCrLc|| | td|tj||_|tj||_|tj||_|j d|_y)a Set `.StepPatch` values, edges and baseline. Parameters ---------- values : 1D array-like or None Will not update values, if passing None edges : 1D array-like, optional baseline : float, 1D array-like or None Nz)Must set *values*, *edges* or *baseline*.T)rrkrrrrrr)rHrrrs rKset_datazStepPatch.set_dataPss >em0@HI I  ::f-DL  **U+DK  ZZ1DN  rL)NNN) rrrrrr r r/rrrr rs@rKrrs?M'! / /D"HHD rLrceZdZdZdZej ddfd ZdZdZ dZ d Z d Z e e e d ZxZS) PolygonzA general polygon patch.ct|jjr?d}|t|jjg|jjdzSy)NzPolygon%d((%g, %g) ...)rz Polygon0())rFrrjrs rKrzPolygon.__str__jsM tzz"" #)ADJJ//0J4::3F3Fq3IJJ JrLTclosedc Tt|di|||_|j|y)z Parameters ---------- xy : (N, 2) array closed : bool, default: True Whether the polygon is closed (i.e., has identical start and end points). **kwargs %(Patch:kwdoc)s Nr:)r.r/_closedr|)rHrrrIrJs rKr/zPolygon.__init__qs' "6"  BrLc|jS)zGet the `.Path` of the polygon.rrs rKrOzPolygon.get_pathrrLc|jS)z%Return whether the polygon is closed.)rrs rK get_closedzPolygon.get_closedrlrLc|jt|k(ryt||_|j|jd|_y)z Set whether the polygon is closed. Parameters ---------- closed : bool True if the polygon is closed NT)rr7r|rZr)rHrs rK set_closedzPolygon.set_closeds; <<4< ' F|  DKKM" rLc.|jjS)z Get the vertices of the path. Returns ------- (N, 2) array The coordinates of the vertices. )rrjrs rKrZzPolygon.get_xyszz"""rLcntj|}|j\}}|jr?|dk(s|dkDrX|d|dk7j r?tj ||dgg}n#|dkDr|d|dk(j r|dd}t||j|_d|_ y)a Set the vertices of the polygon. Parameters ---------- xy : (N, 2) array-like The coordinates of the vertices. Notes ----- Unlike `.Path`, we do not ignore the last input vertex. If the polygon is meant to be closed, and the last point of the polygon is not equal to the first, we assume that the user has not explicitly passed a ``CLOSEPOLY`` vertex, and add it ourselves. rrrrQNrT) rkrshaperrprallrrr)rHrnverts_s rKr|zPolygon.set_xys ZZ^HH  << {fqjber"vo-B-B-D^^R"Q%M2zr!u2335W"T\\2  rLz+The vertices of the path as a (N, 2) array.)doc)rrrrrr r r/rOrrrZr|r rr rs@rKrrgsV" %)"  #B &&C EBrLrcveZdZdZdZej ddfd ZdZdZ dZ d Z d Z d Z d ZxZS) WedgezWedge shaped patch.c|jd|jd|j|j|j|jf}d}||zS)Nrrz rLc t|j|jz dz dkrd\}}tj}n(|j|j}}tj }tj ||}|j|j}|jddd|j|jz z|jz }tj||dgg}g|j||jddtj}nCtj|jddgg}g|j|tj}t||jz|jz||_y)Nhg-q=)rrrr\r)absrrrrmrarcr=rjrrkrri CLOSEPOLYrGr) rHrr connectorrv1v2vrs rKrzWedge._recompute_paths>  dkk)S0 1U :#NFF I![[$++FF Ihhvv& :: !Bdd#tvv ':;dffDBB12AG#))GYG12GGA vv.>?@A7#))7Y77A!dff*t{{2A6 rLc.d|_||_d|_yNT)rrGr)rHrGs rK set_centerzWedge.set_center   rLc.d|_||_d|_yr)rrrrHr[s rK set_radiuszWedge.set_radiuss  rLc.d|_||_d|_yr)rrr)rHrs rK set_theta1zWedge.set_theta1 rrLc.d|_||_d|_yr)rrr)rHrs rK set_theta2zWedge.set_theta2rrLc.d|_||_d|_yr)rr=rrHr=s rKrzWedge.set_widths   rLcR|j|j|jSr`rrrs rKrOzWedge.get_path" ::   "zzrL)rrrrrr r r/rrrrrrrOr rs@rKrrsK ;?$76     rLrc eZdZdZdZej ddgddgddgddgddgdd gddggZejdd fd Z d Z d Z ddZ xZS)ArrowzAn arrow patch.cy)NzArrow()r:rs rKrz Arrow.__str__$srLr6皙?g皙?g333333ӿr9333333?rc Nt|di||j|||||y)aQ Draws an arrow from (*x*, *y*) to (*x* + *dx*, *y* + *dy*). The width of the arrow is scaled by *width*. Parameters ---------- x : float x coordinate of the arrow tail. y : float y coordinate of the arrow tail. dx : float Arrow length in the x direction. dy : float Arrow length in the y direction. width : float, default: 1 Scale factor for the width of the arrow. With a default value of 1, the tail width is 0.2 and head width is 0.6. **kwargs Keyword arguments control the `Patch` properties: %(Patch:kwdoc)s See Also -------- FancyArrow Patch that allows independent control of the head and tail properties. Nr:)r.r/r)rHrbrcdxdyr=rIrJs rKr/zArrow.__init__+s)< "6" aBE*rLc|jSr`rrs rKrOzArrow.get_pathLrrLc|jSr`)rrs rKrzArrow.get_patch_transformOs$$$rLc|||_|||_|||_|||_|||_t j jtj|j|j|jjtj|j|jj|j|jj|_y)a Set `.Arrow` x, y, dx, dy and width. Values left as None will not be updated. Parameters ---------- x, y : float or None, default: None The x and y coordinates of the arrow base. dx, dy : float or None, default: None The length of the arrow along x and y direction. width : float or None, default: None Width of full arrow tail. N)_x_y_dx_dyr0rrrKrkhypotrarctan2r%frozenr)rHrbrcr r r=s rKrzArrow.set_dataRs =DG =DG >DH >DH  DK    ! U288DHHdhh/ = VBJJtxx2 3 Ytww ( VX rL)NNNNN)rrrrrr_create_closedrr r r/rOrrr rs@rKrr!s} D   c S$K#tsDkC: c S#J!  !E.1++@%rLrc zeZdZdZdZdZejdddddddd fd Zdddddddd d Z d Z xZ S) FancyArrowzP Like Arrow, but lets you set head width and head height independently. Tcy)Nz FancyArrow()r:rs rKrzFancyArrow.__str__{srLgMbP?FNfullr)r=length_includes_head head_width head_lengthroverhanghead_starts_at_zeroc ||_||_||_||_||_||_||_||_| |_| |_ | |_ |jt |4|jfddi| y)av Parameters ---------- x, y : float The x and y coordinates of the arrow base. dx, dy : float The length of the arrow along x and y direction. width : float, default: 0.001 Width of full arrow tail. length_includes_head : bool, default: False True if head is to be counted in calculating the length. head_width : float or None, default: 3*width Total width of the full arrow head. head_length : float or None, default: 1.5*head_width Length of arrow head. shape : {'full', 'left', 'right'}, default: 'full' Draw the left-half, right-half, or full arrow. overhang : float, default: 0 Fraction that the arrow is swept back (0 overhang means triangular shape). Can be negative or greater than one. head_starts_at_zero : bool, default: False If True, the head starts being drawn at coordinate 0 instead of ending at coordinate 0. **kwargs `.Patch` properties: %(Patch:kwdoc)s rTN)rrrrr0_length_includes_head _head_width _head_length_shape _overhang_head_starts_at_zero _make_vertsr.r/r)rHrbrcr r r=rrrrrrrIrJs rKr/zFancyArrow.__init__~s~T %9"%' !$7!  ;D;F;rL)rbrcr r r=rrc|||_|||_|||_|||_|||_|||_|||_|j|j|jy)a Set `.FancyArrow` x, y, dx, dy, width, head_with, and head_length. Values left as None will not be updated. Parameters ---------- x, y : float or None, default: None The x and y coordinates of the arrow base. dx, dy : float or None, default: None The length of the arrow along x and y direction. width : float or None, default: None Width of full arrow tail. head_width : float or None, default: None Total width of the full arrow head. head_length : float or None, default: None Length of arrow head. N) rrrrr0r!r"r&r|r)rHrbrcr r r=rrs rKrzFancyArrow.set_datasy. =DG =DG >DH >DH  DK  !)D   " +D   DJJrLcZ|jd|jz}n |j}|jd|z}n |j}tj|j |j }|jr|}n||z}tj|dk(rtjddg|_ y||}}|j|j}}tjddg| | dz g| d|z z| dz g| | dz g| dgg} |js| |dgz } |jr | |dz dgz } |jdk(r| } na| ddgz} |jd k(r| } nH|jd k(r!tj| dd| d ddg} nt!d |j|dk7r|j |z } |j |z } nd \} } | | g| | gg}tj"| ||j$|j z|j&|j zgz|_ y)NrVg?rrQr6rleftrrightrzGot unknown shape: r_)r!r0r"rkrrrr rrrr$arrayr%r#rrdotrr)rHrrdistancelengthhwhlhsr left_half_arrowcoordsright_half_arrowcxsxMs rKr&zFancyArrow._make_vertssI    #T[[J))J    $ *K++K88DHHdhh/  % %F +F 776?a 1a&)DJ B^^T[[B hhc rcAgB"q)2#'"! (O--K#33((K!OQ#77{{f$(#2aW#< ;;')-F[[F* ^^_Sb-A-=bf"f-E-GHF%':4;;/%JKK1}XX(XX(BbRC9%A*$(("$((".DJrL) rrrrrrr r r/rr&r rs@rKrrts]M5T!!%*5<5rIrJs rKr/zCirclePolygon.__init__)s,    D#)q Dr2r3s rKrzEllipse.__str__>s@ Qa DKK5CTzrLrrnc t|di|||_||c|_|_||_t j|_d|_ tj|_ y)a Parameters ---------- xy : (float, float) xy coordinates of ellipse centre. width : float Total length (diameter) of horizontal axis. height : float Total length (diameter) of vertical axis. angle : float, default: 0 Rotation in degrees anti-clockwise. Notes ----- Valid keyword arguments are: %(Patch:kwdoc)s r9Nr:) r.r/rEr0r1_angler unit_circlerr;rrr)rHrr=r>r2rIrJs rKr/zEllipse.__init__Ds^( "6" $)6! T\ %%' ),% * < < >rLc|j|jd|j|jdf}|j|j}|j|j}t j j|dz|dz|jzj|jjdd|jz j||_ y)a! Notes ----- This cannot be called until after this has been added to an Axes, otherwise unit conversion will fail. This makes it very important to call the accessor method and not directly access the transformation member variable. rrrN) rrErr0r1rrrKr;rLr2r%r)rHrGr=r>s rK_recompute_transformzEllipse._recompute_transformgs%%dll1o6%%dll1o68##DKK0$$T\\2! 3 3 5 U53; t/L/L L M Z # U1a$777 8 Y ! rLc|jS)zReturn the path of the ellipse.rrs rKrOzEllipse.get_pathzrrLc:|j|jSr`)rJrrs rKrzEllipse.get_patch_transform~s !!#$$$rLc ||_d|_y)zs Set the center of the ellipse. Parameters ---------- xy : (float, float) TN)rErr{s rKrzEllipse.set_centers  rLc|jS)z!Return the center of the ellipse.rErs rKrczEllipse.get_centerrlrLc ||_d|_y)zl Set the width of the ellipse. Parameters ---------- width : float TNr~rs rKrzEllipse.set_width  rLc|jS)z2 Return the width of the ellipse. rfrs rKrgzEllipse.get_widths{{rLc ||_d|_y)zn Set the height of the ellipse. Parameters ---------- height : float TNr)rHr>s rKrzEllipse.set_heights  rLc|jS)z!Return the height of the ellipse.rjrs rKrkzEllipse.get_heightrlrLc ||_d|_y)zl Set the angle of the ellipse. Parameters ---------- angle : float TN)rGrrxs rKryzEllipse.set_anglerQrLc|jS)z Return the angle of the ellipse.rGrs rKrozEllipse.get_anglerrLcD|jjgdS)z Return the corners of the ellipse bounding box. The bounding box orientation is moving anti-clockwise from the lower left corner defined before rotation. ))rr)rrr^)rrr`rs rKrazEllipse.get_cornerss#'')33 02 2rLc|j|jkr"|jjddg}n!|jjddg}|Dcgc] }t |c}Scc}w)z Return the vertices coordinates of the ellipse. The definition can be found `here `_ .. versionadded:: 3.8 r_rrr]rrr=r>rrrRrHretrbs rK get_verticeszEllipse.get_verticesh :: #**,667HIC**,667HIC"%&Qa&&&!A6c|j|jkr"|jjddg}n!|jjddg}|Dcgc] }t |c}Scc}w)z Return the co-vertices coordinates of the ellipse. The definition can be found `here `_ .. versionadded:: 3.8 r]r[r_rZr\r]s rKget_co_verticeszEllipse.get_co_verticesr`ra)rrrrrr r r/rJrOrrrcr rGrrgr=rrkr>ryror2rar_rcr rs@rKrCrC;s 34 ? ?D &% j* -F  Y *E j* -F  Y *E2 ' 'rLrCceZdZdZej dfd ZdZdZdZ e e eZ dZ dZ e e e ZdZd Ze eeZd Zd Zd Zd Ze eeZdZdZdZxZS)Annulusz An elliptical annulus. c ~t|di||j|||_||_||_d|_y)a Parameters ---------- xy : (float, float) xy coordinates of annulus centre. r : float or (float, float) The radius, or semi-axes: - If float: radius of the outer circle. - If two floats: semi-major and -minor axes of outer ellipse. width : float Width (thickness) of the annular ring. The width is measured inward from the outer ellipse so that for the inner ellipse the semi-axes are given by ``r - width``. *width* must be less than or equal to the semi-minor axis. angle : float, default: 0 Rotation angle in degrees (anti-clockwise from the positive x-axis). Ignored for circular annuli (i.e., if *r* is a scalar). **kwargs Keyword arguments control the `Patch` properties: %(Patch:kwdoc)s Nr:)r.r/ set_radiirGr=r2r)rHrrr=r2rIrJs rKr/zAnnulus.__init__s=2 "6" q    rLc|j|jk(r |j}n|j|jf}dg|j||j|jzS)Nz.Annulus(xy=(%s, %s), r=%s, width=%s, angle=%s))arrGr=r2rHrs rKrzAnnulus.__str__s] 66TVV A A?9$++9q9$**9djj9: :rLc.||_d|_d|_y)zs Set the center of the annulus. Parameters ---------- xy : (float, float) NT)rErrr{s rKrzAnnulus.set_centers   rLc|jS)z!Return the center of the annulus.rOrs rKrczAnnulus.get_center*rlrLc|t|j|jkDr td||_d|_d|_y)z Set the width (thickness) of the annulus ring. The width is measured inwards from the outer ellipse. Parameters ---------- width : float z>Width of annulus must be less than or equal to semi-minor axisNT)minrirrr0rrrs rKrzAnnulus.set_width0sD 3tvvtvv& &PR R   rLc|jS)z1Return the width (thickness) of the annulus ring.rfrs rKrgzAnnulus.get_widthBrrLc.||_d|_d|_y)zq Set the tilt angle of the annulus. Parameters ---------- angle : float NT)rGrrrxs rKryzAnnulus.set_angleHs   rLc|jS)z Return the angle of the annulus.rWrs rKrozAnnulus.get_angleTrrLc@t||_d|_d|_y)zv Set the semi-major axis *a* of the annulus. Parameters ---------- a : float NT)rrirr)rHris rK set_semimajorzAnnulus.set_semimajorZq  rLc@t||_d|_d|_y)zv Set the semi-minor axis *b* of the annulus. Parameters ---------- b : float NT)rrrrrs rK set_semiminorzAnnulus.set_semiminorfrtrLctj|dk(r|\|_|_n;tj|dk(rt |x|_|_n t dd|_d|_y)aE Set the semi-major (*a*) and semi-minor radii (*b*) of the annulus. Parameters ---------- r : float or (float, float) The radius, or semi-axes: - If float: radius of the outer circle. - If two floats: semi-major and -minor axes of outer ellipse. )rQr:z(Parameter 'r' must be one or two floats.NT)rkrrirrrrrrjs rKrgzAnnulus.set_radiirs] 88A;$ NDFDF XXa[B #Ah &DFTVGH H  rLc2|j|jfS)z:Return the semi-major and semi-minor radii of the annulus.)rirrs rK get_radiizAnnulus.get_radiisvvtvv~rLctjj|j||fj |j j |j|jj|Sr`) rrrKrrLr2r%rGr)rHrrirs rK_transform_vertszAnnulus._transform_vertsslz""$ UD**Aq624 Z # Y..t{{;=Yu   rLctjdd}|j|j|j}}}|j |j ||}|j |j ddd||z ||z }tj|||dddfdg}tj|jtj|jddtjtjg}t|||_ y)Nrrrr\r)rrrirr=r{rjrkvstackhstackrirmrr) rHrrirrrrrrs rKrzAnnulus._recompute_pathshhq#&&$&&$**a1  " "3<<A 6  " "3<<"#5q1ua!e D IIr2r!Q$x0 1 IIsyy$++yy}dkk~~' (!QZ rLcR|j|j|jSr`rrs rKrOzAnnulus.get_pathrrLr6)rrrrr r r/rrrcr rGrrgr=ryror2rsrvrgryradiir{rrOr rs@rKreres@: j* -F$ Y *E  Y *E  , Y *E  rLrecfeZdZdZdZej dfd ZdZdZ e e eZ xZ S)Circlez A circle patch. cb|jd|jd|jf}d}||zS)NrrzCircle(xy=(%g, %g), radius=%g))rGr[r3s rKrzCircle.__str__s1{{1~t{{1~t{{:.TzrLc Dt|||dz|dzfi|||_y)a& Create a true circle at center *xy* = (*x*, *y*) with given *radius*. Unlike `CirclePolygon` which is a polygonal approximation, this uses Bezier splines and is much closer to a scale-free circle. Valid keyword arguments are: %(Patch:kwdoc)s rQN)r.r/r[)rHrr[rIrJs rKr/zCircle.__init__s* VaZ!>v> rLc4d|zx|_|_d|_y)zm Set the radius of the circle. Parameters ---------- radius : float rQTN)r=r>rrs rKrzCircle.set_radiuss$%v:- T[ rLc |jdz S)z Return the radius of the circle.rHrrs rK get_radiuszCircle.get_radiusszzBrLrA) rrrrrr r r/rrr r[r rs@rKrrs?    j* -FrLrceZdZdZdZej ddddfd ZejdZ dZ d Z xZ S) Arczx An elliptical arc, i.e. a segment of an ellipse. Due to internal optimizations, the arc cannot be filled. c|jd|jd|j|j|j|j|j f}d}||zS)NrrzEArc(xy=(%g, %g), width=%g, height=%g, angle=%g, theta1=%g, theta2=%g))rGr=r>r2rrr3s rKrz Arc.__str__sO A A  TZZdkkC<TzrLr6gv@)r2rrc 8|jdd}|r tdt | |||fd|i|||_||_|j \|_|_|_ |_ tj|j|j|_ y)a Parameters ---------- xy : (float, float) The center of the ellipse. width : float The length of the horizontal axis. height : float The length of the vertical axis. angle : float Rotation of the ellipse in degrees (counterclockwise). theta1, theta2 : float, default: 0, 360 Starting and ending angles of the arc in degrees. These values are relative to *angle*, e.g. if *angle* = 45 and *theta1* = 90 the absolute starting angle is 135. Default *theta1* = 0, *theta2* = 360, i.e. a complete ellipse. The arc is drawn in the counterclockwise direction. Angles greater than or equal to 360, or smaller than 0, are represented by an equivalent angle in the range [0, 360), by taking the input value mod 360. Other Parameters ---------------- **kwargs : `~matplotlib.patches.Patch` properties Most `.Patch` properties are supported as keyword arguments, except *fill* and *facecolor* because filling is not supported. %(Patch:kwdoc)s r)FzArc objects cannot be filledr2N) setdefaultrr.r/rr_theta_stretch_theta1_theta2_stretched_width_stretched_heightrrr) rHrr=r>r2rrrIr)rJs rKr/z Arc.__init__sH  / ;< < UFB%B6B  #'#6#6#8 !t|T%: XXdllDLL9 rLc<|jsy|j|j|j}|j |j |j f|j dz \}}d}||kr||krtj||Sdfd}tj|jxs|jdj|jz }tj j#|}t%} t'|j(dd|j(d dD]~\} } |g| | } | j*\} }t-j.t-j0|| d zd z}| j3||j4|k||j6kzt9| |j6gz} |j4}t-j:|j4}|j=t-j>|t-j@|f}|jB}| D]=}|r5tjD||d |_!tj||d}nd }|}?||_!y) a Draw the arc to the given *renderer*. Notes ----- Ellipses are normally drawn using an approximation that uses eight cubic Bezier splines. The error of this approximation is 1.89818e-6, according to this unverified source: Lancaster, Don. *Approximating a Circle or an Ellipse Using Four Bezier Cubic Splines.* https://www.tinaja.com/glib/ellipse4.pdf There is a use case where very large ellipses must be drawn with very high accuracy, and it is too expensive to render the entire ellipse with enough segments (either splines or line segments). Therefore, in the case where either radius of the ellipse is large enough that the error of the spline approximation will be visible (greater than one pixel offset from the ideal), a different technique is used. In that case, only the visible parts of the ellipse are drawn, with each visible arc using a fixed number of spline segments (8). The algorithm proceeds as follows: 1. The points where the ellipse intersects the axes (or figure) bounding box are located. (This is done by performing an inverse transformation on the bbox such that it is relative to the unit circle -- this makes the intersection calculation much easier than doing rotated ellipse intersection directly.) This uses the "line intersecting a circle" algorithm from: Vince, John. *Geometry for Computer Graphics: Formulae, Examples & Proofs.* London: Springer-Verlag, 2005. 2. The angles of each of the intersection points are calculated. 3. Proceeding counterclockwise starting in the positive x-direction, each of the visible arc-segments between the pairs of vertices are drawn using the Bezier arc approximation technique implemented in `.Path.arc`. Nr\g\!Ac||z }||z }||z||zz}||z||zz }||z}||z } | dk\rtjd|} tj| } tj||z| |z| zz|z | |zt || zz|z g||z| |z| zz |z | |zt || zz |z ggStj dS)Nr6rr)rkcopysignsqrtr,rr) rBrCrDrEr r dr2DD2discrimsign_dy sqrt_discrims rKline_circle_intersectz'Arc.draw..line_circle_intersectWsbBbBr'BG#CR"r'!AQBBhG#~++a,!www/ xx2v" | ;;sBrBwR@2v" | ;;sBrBwR@ABB xx''rLcd}||kr||}}n||}}||kr||}}n||}} ||||} | j\} } | ||z | k| ||zkz||z | kz| ||zkzS)Ng& .>)T) rBrCrDrEepsilonx0ex1ey0ey1exysxsysrs rKsegment_circle_intersectz*Arc.draw..segment_circle_intersectisGBwrSrSBwrSrS'BB7CUUFBw#S7](:;=2%'*,sW}*<> rLFrootrrrT)#rrJrrrrrr'rrrJaxes get_figurerMrNrr@ transformedsetziprjrrkrad2degrrrrsorteddeg2radracossinrr)rHrdata_to_screen_transpwidthpheight inv_errorrbox_path_transformbox_paththetasp0p1rrbrctheta last_theta theta1_radrs path_originalrs @rKrzArc.drawsl\!  !!#  $668 * *D,A,A,0,B,B,D E * *6 2 3 - I 'I"5::dH- - ($ *  & & (PT__%_5P'V'V W  " # &&(445GH(++CR0(2C2CAB2GH HFB)3233B44DAqZZ 1a 01C73>E MMt||e+ 0DEF H  H4<<.0\\ ZZ - (( VVJ  !3 4    E!XXj%;  4*J # rLc J|j}tdt||j|j|j |j fDrK|\|_|_|_|_tj|j|j|_ yy)Nc3,K|] \}}||k7ywr`r:)rdrirs rKrgz#Arc._update_path..s6$!QqAv6s) rrprrrrrrrr)rH stretcheds rKrzArc._update_paths'') 6#DLL$,,8M8M 224#56 6(1 %T\4<)>  #$,, =DJ  6rLcd}|j|j}|j|j}||k7rj|j|j k7r|jdz|j dzk(s2||j||z }||j ||z }||||fS|j|j ||fS)Nctj|}tj|}tj|}tjtj ||z|}|dzdzS)Nr)rkrrrrr)rrKrbrcsthetas rK theta_stretchz)Arc._theta_stretch..theta_stretchsVJJu%Eu Au AZZ 519a 89FSLC' 'rLr)rr=rr>rr)rHrr=r>rrs rKrzArc._theta_stretchs (##DJJ/$$T[[1 VO[[DKK/[[3&$++*;;"4;;?F"4;;?F65&0 0{{DKK66rL)rrrrrr r r/r r rrrr rs@rKrrsV 3u-:-:^ L# L#\>7rLrc|i}|j}|jdd}|j|}|j|}t |j |dz z |j |dz z f|j|z|j|z|tjd}|j||j|y)a> A debug function to draw a rectangle around the bounding box returned by an artist's `.Artist.get_window_extent` to test whether the artist is returning the correct bbox. *props* is a dict of rectangle props with the additional property 'pad' that sets the padding around the bbox in points. NpadrQF)rr=r>r)rclip_on) copypopr#rr,rBrCr=r>rrrr)r rpropsr)rrMrs rK bbox_artistrs } JJLE ))E1 C  # #C (C #6 # #H -D GGcAg twwq0 1jj3t{{S'8 Z99;U LAHHUOFF8rLct|j|j|j|dd}||j ||j |y)z A debug function to draw a rectangle around the bounding box returned by an artist's `.Artist.get_window_extent` to test whether the artist is returning the correct bbox. F)rr=r>r"r)rN)r,rr=r>rr)rMrr(rQrs rK draw_bboxrsE TWWDJJt{{!u >A  FF8rLc|eZdZdZdZdZedZedZee jddd d Z y ) _Stylez A base class for the Styles. It is meant to be a container class, where actual styles are declared as subclass of it, and it provides some helper functions. c"tjjdi|jd|j |jd|j dzdj t dj|jzdziy)Nz:tablez:table_and_acceptsz .. ACCEPTS: [|z '{}' ]r:) r r registerr pprint_stylesjoinrnformat _style_listclss rK__init_subclass__z_Style.__init_subclass__s ## ||nF #S%6%6%8||n. /!!#)*((3x@AB'  rLc |jddjd}|dj} |j|} |ddDcgc]}|jd}}|D cic]\} } | t | } } } |d ii| |S#t$r}t d||d}~wwxYwcc}wcc} } w#t $r}t d ||d}~wwxYw) z>Return the instance of the subclass with the given style name.rr,rzUnknown style: Nr=zIncorrect style argument: r:)replacerolowerrKeyErrorrr) r stylenamerI_list_name_clserrr _args_pairkr_argss rK__new__z_Style.__new__ s!!#r*005a  G??5)D E27).* s4Ts4y4sz c3&K|] }d|z yw)rNr:)rdcls rKrgz'_Style.pprint_styles..+ s#?C"H#?sr9rc3DK|]\}}|j|ywr`ljustrdrrs rKrgz'_Style.pprint_styles../ sLrdjjnL rNc3DK|]\}}|j|ywr`rrs rKrgz'_Style.pprint_styles..1 sI84 2Irz )prefix) ritemsrstrinspect signaturermaxrtextwrapindent)rrtablecolumncol_lentable_formatstrrow rst_tables rKrz_Style.pprint_styles sK1> %(OO$9$9$; = !tS LLbM))#./"5? A=>DG;O34V44OO))#?w#??II   IILSq75KL L   qr$iiIs37HII$     y99%=P$sAD&/D,)D1 z3.10.0z%This method is never used internally.z6No replacement. Please open an issue if you use this.)message alternativect||jst|d|j||j|<y)zRegister a new style.z must be a subclass of N) issubclass_Baserr)rrstyles rKrz_Style.register7 s;%+w&=cii[IJ J %rLN) rrrrrr classmethodrrr deprecatedrr:rLrKrrsi  &+$::.T__7L &  &rLrrc|tjt||S|||xs|jj <|S)z=Class decorator that stashes a class in a (style) dictionary.r) functoolspartial_register_stylerr) style_listrrs rKrrD s= {  *4HH/2Jt+s||))+, JrLceZdZdZiZeeGddZeeGddZeeGddZeeGdd Z eeGd d e Z eeGd d Z eeGddZ eeGddZ eeGddZeeGddeZy)BoxStylea `BoxStyle` is a container class which defines several boxstyle classes, which are used for `FancyBboxPatch`. A style object can be created as:: BoxStyle.Round(pad=0.2) or:: BoxStyle("Round", pad=0.2) or:: BoxStyle("Round, pad=0.2") The following boxstyle classes are defined. %(BoxStyle:table)s An instance of a boxstyle class is a callable object, with the signature :: __call__(self, x0, y0, width, height, mutation_size) -> Path *x0*, *y0*, *width* and *height* specify the location and size of the box to be drawn; *mutation_size* scales the outline properties such as padding. ceZdZdZddZdZy)BoxStyle.Squarez A square box.c||_yz Parameters ---------- pad : float, default: 0.3 The amount of padding around the original box. NrrHrs rKr/zBoxStyle.Square.__init__p DHrLc||jz}|d|zz|d|zz}}||z ||z }}||z||z}}tj||f||f||f||fgSNrQrrr) rHrBrCr=r> mutation_sizerrDrEs rK__call__zBoxStyle.Square.__call__y s{$((*C!AGOVa#g-=6E#XrCxB%ZfB&&bB8b"XBx8: :rLNrrrrrr/r)r:rLrKSquarerl s  :rLr,ceZdZdZddZdZy)BoxStyle.CirclezA circular box.c||_yr!r"r#s rKr/zBoxStyle.Circle.__init__ r$rLc||jz}|d|zz|d|zz}}||z ||z }}tj||dz z||dz zft||dz Sr&)rrcircler)rHrBrCr=r>r(rs rKr)zBoxStyle.Circle.__call__ sr$((*C!AGOVa#g-=6E#XrCxB;;UQYVaZ@ #E6 2Q 68 8rLNr*r+r:rLrKrr. s  8rLrceZdZdZddZdZy)BoxStyle.EllipsezC An elliptical box. .. versionadded:: 3.7 c||_yr!r"r#s rKr/zBoxStyle.Ellipse.__init__ r$rLcf||jz}|d|zz|d|zz}}||z ||z }}|tjdz }|tjdz }tj ||j ||dz z||dz z} | j tjSr&) rmathrrrKr%transform_pathrrH) rHrBrCr=r>r(rrirrQs rKr)zBoxStyle.Ellipse.__call__ s$((*C!AGOVa#g-=6E#XrCxB ! $A1%AJ$$Q*44R%!)^57&1*_FE''(8(8(:; ;rLNr*r+r:rLrKrCr3 s   r(rrDrEr dxxs rKr)zBoxStyle.LArrow.__call__ s$((*C!AGOVa#g-=6E#XrCxB%ZfBr'QBq&CcCiB&&s(B"bB8b3h^s(BH%Rb'9s(BH%s(B!" "rLNr*r+r:rLrKLArrowr9 s:  "rLr?ceZdZdZdZy)BoxStyle.RArrowz-A box in the shape of a right-pointing arrow.ctjj||||||}d|z|z|jdddfz |jdddf<|S)NrQr)rr?r)rj)rHrBrCr=r>r(ps rKr)zBoxStyle.RArrow.__call__ sT((b"eV]r(rdrrDrEcpcoms rKr)zBoxStyle.Round.__call__ sr $((*C!!"T%7%77!AGOVa#g-=6E#XrCxB%ZfB7B-7B-r(RbMrBw-r(R"WbM7B-r(RbMrBw-r(R"WbM7B- !B;;;;;; ;;;; ;;;; ;;;; >> #CC= rLrNr+r:rLrKRoundrL s' /( !rLrYceZdZdZddZdZy)BoxStyle.Round4zA box with rounded edges.Nc ||_||_y)z Parameters ---------- pad : float, default: 0.3 The amount of padding around the original box. rounding_size : float, default: *pad*/2 Rounding of edges. NrNrPs rKr/zBoxStyle.Round4.__init__A rQrLcF||jz}|jr||jz}n|dz }|d|zzd|zz }|d|zzd|zz }||z |z||z |z}}||z||z} }||f||z||z f||z ||z f||f||z||zf||z| |z f|| f||z | |zf||z| |zf|| f||z | |z f||z ||zf||f||fg} tjtjtjtjtjtjtjtjtjtjtjtjtjtj g} t| | S)NrHrQ)rrOrrmCURVE4rrTs rKr)zBoxStyle.Round4.__call__M s $((*C!!"T%7%772XAGOa"f,Ea#g%B.F#X]BHrMB%ZfBr(7BG$rBwR&82r(7BG$rBwR&82r(7BG$rBwR&82r(7BG$rBwR&82r(r( B;;;; T[[;; T[[;; T[[;; T[[>> #CC= rLrXr+r:rLrKRound4r[= s' / !rLr_c$eZdZdZddZdZdZy)BoxStyle.SawtoothzA box with a sawtooth outline.Nc ||_||_y)z Parameters ---------- pad : float, default: 0.3 The amount of padding around the original box. tooth_size : float, default: *pad*/2 Size of the sawtooth. N)r tooth_size)rHrrcs rKr/zBoxStyle.Sawtooth.__init__r sDH(DOrLc`||jz}|j|jdz|z}n|j|z}|dz }|d|zz|z }|d|zz|z }t||z |dzz dz} t||z |dzz dz} ||z |z||z |z}}||z||z} } |gtj||z| |z d| zdz| | |z| | |z g| zdd| zdz| tj| |z ||zd| zdz|||z |||zg| zdd| zdz} g|||z |||zg| zdd| zdz|tj||z| |z d| zdz| | |z| | |z g| zdd| zdz| tj| |z ||zd| zdz}gt | || d|dfS)NrrQrr)rrcroundrklinspacer)rHrBrCr=r>r(rrchszdsx_ndsy_nrDrErrs rK_get_sawtooth_verticesz(BoxStyle.Sawtooth._get_sawtooth_vertices~ su $((*C&!XX]]: !__}< q.CAGOj0Ea#g% 2F5:-*q.ABQFE6J.:>BCaGE#X^R#X^B%ZfB[[c28QY]CrCxR#X.6 5C[[c28QY]CrCxR#X.6 5C B rCxR#X.6 5C[[c28QY]CrCxR#X.6 5C [[c28QY]C B2SR[12a5"Q%.1 1rLcF|j|||||}t|dS)NTr)rjr)rHrBrCr=r>r( saw_verticess rKr)zBoxStyle.Sawtooth.__call__ s+66r2u7=}NL T2 2rLrX)rrrrr/rjr)r:rLrKSawtoothran s, )$ 2L 3rLrmceZdZdZdZy)BoxStyle.Roundtoothz&A box with a rounded sawtooth outline.c&|j|||||}tj||dgg}tjgtj tj gt |dz dzzztjgz}t||S)NrrrQ)rjrkrrrmrSrFr)rHrBrCr=r>r(rlris rKr)zBoxStyle.Roundtooth.__call__ s66r27><,q/9J*KLLkk]kk4;;/C 4Ea4G!3KLMnn%&E e, ,rLNrDr:rLrK Roundtoothro s 4 -rLrqN)rrrrrrr,rrCr?rErJrYr_rmrqr:rLrKrrL s@8K[!::":,[!88"8([!<<"<6[!"""">[!"[!"!"!""!H[!7!7!"7!r[!.!.!".!`[!8383"83t[! -X -" -rLrceZdZdZiZGddZeeGddeZeeGddeZeeGdd eZ eeGd d eZ eeGd d eZ y)ConnectionStylea `ConnectionStyle` is a container class which defines several connectionstyle classes, which is used to create a path between two points. These are mainly used with `FancyArrowPatch`. A connectionstyle object can be either created as:: ConnectionStyle.Arc3(rad=0.2) or:: ConnectionStyle("Arc3", rad=0.2) or:: ConnectionStyle("Arc3, rad=0.2") The following classes are defined %(ConnectionStyle:table)s An instance of any connection style class is a callable object, whose call signature is:: __call__(self, posA, posB, patchA=None, patchB=None, shrinkA=2., shrinkB=2.) and it returns a `.Path` instance. *posA* and *posB* are tuples of (x, y) coordinates of the two points to be connected. *patchA* (or *patchB*) is given, the returned path is clipped so that it start (or end) from the boundary of the patch. The path is further shrunk by *shrinkA* (or *shrinkB*) which is given in points. c&eZdZdZdZdZ ddZy)ConnectionStyle._Basea A base class for connectionstyle classes. The subclass needs to implement a *connect* method whose call signature is:: connect(posA, posB) where posA and posB are tuples of x, y coordinates to be connected. The method needs to return a path connecting two points. This base class defines a __call__ method, and a few helper methods. cfdS)zw Return a predicate function testing whether a point *xy* is contained in *patch*. cNjt|d|ddS)Nrr)rbrc)rtr)rrs rKz1ConnectionStyle._Base._in_patch.. s*enn"Q%2a513346rLr:)rHrs `rK _in_patchzConnectionStyle._Base._in_patch s 6 6rLc|r t||\}}|r t||\}}|S|S#t$rY!wxYw#t$rY|SwxYw)a$ Clip *path* at its start by the region where *in_start* returns True, and at its stop by the region where *in_stop* returns True. The original path is assumed to start in the *in_start* region and to stop in the *in_stop* region. )rr)rHrRin_startin_stoprs rK_clipzConnectionStyle._Base._clip sm.tX>GAt.tW=GD!K4K" "Ks)8 55 AANc >|j||}|j||r|j|nd|r|j|nd}|j||rtg|jd|nd|r tg|jd|}|Sd}|S)z Call the *connect* method to create a path between *posA* and *posB*; then clip and shrink the path. Nrr)connectr}ryrrj)rHposAposBshrinkAshrinkBpatchApatchBrRs rKr)zConnectionStyle._Base.__call__ s <<d+D::*0v&d*0v&dD ::=D 9t}}Q/99$>E :t}}R0:':D KLPD KrL)rHrHNN)rrrrryr}r)r:rLrKrru s  6 *BF rLrceZdZdZddZdZy)ConnectionStyle.Arc3uN Creates a simple quadratic Bézier curve between two points. The curve is created so that the middle control point (C1) is located at the same distance from the start (C0) and end points(C2) and the distance of the C1 to the line connecting C0-C2 is *rad* times the distance of C0-C2. c||_y)zy Parameters ---------- rad : float Curvature of the curve. N)rad)rHrs rKr/zConnectionStyle.Arc3.__init__& r$rLc|\}}|\}}||zdz ||zdz }}||z ||z } } |j} || | zz|| | zz } } ||f| | f||fg}tjtjtjg}t||S)NrH)rrrmrS)rHrrrDrEx2y2x12y12r r fr6cyrjris rKrzConnectionStyle.Arc3.connect/ sFBFBR2~R2~C"Wb2gBA1r6\3R<BRRR"H[[[[[["E%( (rLNrrrrrr/rr:rLrKArc3r s   )rLrceZdZdZddZdZy)ConnectionStyle.Angle3u Creates a simple quadratic Bézier curve between two points. The middle control point is placed at the intersecting point of two lines which cross the start and end point, and have a slope of *angleA* and *angleB*, respectively. c ||_||_y)z Parameters ---------- angleA : float Starting angle of the path. angleB : float Ending angle of the path. N)angleAangleB)rHrrs rKr/zConnectionStyle.Angle3.__init__K s!DK DKrLc \|\}}|\}}tjtj|j}tjtj|j}tjtj|j } tjtj|j } t ||||||| | \} } ||f| | f||fg} tjtjtjg}t| |Sr`) r6rradiansrrrrrrmrS)rHrrrDrErrcosAsinAcosBsinBr6rrjris rKrzConnectionStyle.Angle3.connectY sFBFB88DLL56D88DLL56D88DLL56D88DLL56D%b"dD&("dD:FBR2r(RH5H[[$++t{{;E%( (rLN)Zrrr:rLrKAngle3rB s  ! )rLrceZdZdZddZdZy)ConnectionStyle.Angleu] Creates a piecewise continuous quadratic Bézier path between two points. The path has a one passing-through point placed at the intersecting point of two lines which cross the start and end point, and have a slope of *angleA* and *angleB*, respectively. The connecting edges are rounded with *rad*. c.||_||_||_y)a Parameters ---------- angleA : float Starting angle of the path. angleB : float Ending angle of the path. rad : float Rounding radius of the edge. N)rrr)rHrrrs rKr/zConnectionStyle.Angle.__init__t s!DK DKDHrLc |\}}|\}}tjtj|j}tjtj|j}tjtj|j } tjtj|j } t ||||||| | \} } ||fg} tjg}|jdk(r3| j| | f|jtjn|| z || z }}tj||}|j|z }|| z || z }}tj||}|j|z }| j| ||zz| ||zzf| | f| ||zz| ||zzfg|jtjtjtjg| j||f|jtjt| |S)Nr6)r6rrrrrrrrmrrrrkrextendrS)rHrrrDrErrrrrrr6rrjridx1dy1d1f1dx2dy2d2f2s rKrzConnectionStyle.Angle.connect sFBFB88DLL56D88DLL56D88DLL56D88DLL56D%b"dD&("dD:FBRzH[[MExx2~R) T[[)7BGSXXc3'XX]7BGSXXc3'XX]"sRx-cBh!?"$b"$sRx-cBh!?!AB dkk4;; DE OORH % LL %%( (rLN)rrr6rr:rLrKAnglerj s  &! )rLrceZdZdZddZdZy)ConnectionStyle.Arcu? Creates a piecewise continuous quadratic Bézier path between two points. The path can have two passing-through points, a point placed at the distance of *armA* and angle of *angleA* from point A, another point with respect to point B. The edges are rounded with *rad*. NcJ||_||_||_||_||_y)a Parameters ---------- angleA : float Starting angle of the path. angleB : float Ending angle of the path. armA : float or None Length of the starting arm. armB : float or None Length of the ending arm. rad : float Rounding radius of the edges. N)rrarmAarmBr)rHrrrrrs rKr/zConnectionStyle.Arc.__init__ s'(!DK DKDIDIDHrLc|\}}|\}}||fg}g}tjg} |jrtjtj |j } tjtj |j } |j|jz } |j|| | zz|| | zzf|j} |j|| | zz|| | zzf|jr|tjtj |j} tjtj |j}||j| zz||j|zz}}|r|d\}}||z ||z }}||z||zzdz}|j||j|z|z z||j|z|z zf|j|| jtjtjtjgn |d\}}||z ||z }}||z||zzdz}||jz } || |z|z z|| |z|z zf||fg}|r|d\}}||z ||z }}||z||zzdz}|j||j|z|z z||j|z|z zf|j|| jtjtjtjg|j||f| jtjt|| S)Nrr)rrmrr6rrrrrrrrrrrS)rHrrrDrErrrjroundedrirrdrrx_armBy_armBxpypr r dds rKrzConnectionStyle.Arc.connect sFBFBRzHG[[MEyyxx T[[ 9:xx T[[ 9:II(QX rAH}=>IIQX rAH}=>yyxx T[[ 9:xx T[[ 9:!#dii$&6!6TYY=M8M$R[FB#b[&2+Br'BG+2BNNBB);$;$&B);$;$=>OOG,LL$++"&++"&++"/0&b\FB#b[&2+Br'BG+2BMR",b1r6B;.>?"F+- Bb"r'B2gR'B.TXX]R%7 7 "TXX]R%7 7 9:( dkk"kk"kk+, OORH % LL %%( (rL)rrNNr6rr:rLrKrr s  69 )rLrceZdZdZddZdZy)ConnectionStyle.Bara  A line with *angle* between A and B with *armA* and *armB*. One of the arms is extended so that they are connected in a right angle. The length of *armA* is determined by (*armA* + *fraction* x AB distance). Same for *armB*. Nc<||_||_||_||_y)a Parameters ---------- armA : float Minimum length of armA. armB : float Minimum length of armB. fraction : float A fraction of the distance between two points that will be added to armA and armB. angle : float or None Angle of the connecting line (if None, parallel to A and B). N)rrfractionr2)rHrrrr2s rKr/zConnectionStyle.Bar.__init__ s "DIDI$DMDJrLcr|\}}|x\}}\}}tj||z ||z } ||z ||z } } | | z| | zzdz} | | z | | z }} |j|j}}|jt j |j}| |z }| tj|z}| tj|z}||tj|zz||tj|zz}}||z }||z ||z } } | | z| | zzdz}| |z | |z }} t||}|j| z|z}|||zz||| zz }}|||zz||| zz }}||f||f||f||fg}tjtjtjtjg}t||S)Nr)r6atan2rrr2rkrrrrrrrmr)rHrrrDrEx20y20rrrr r rddxddyrrtheta0dthetadldLdd2armrcx1cy1cx2cy2rjris rKrzConnectionStyle.Bar.connect) sFB $ $HCvr2ZZRb1F"Wb2gBr'BG#*BBwRCDII$Dzz%DJJ/&$((6**$((6**b488F#333R"txx?O:O5OBbyb"r'BBwb(R/8R#XSdD/C "S(AAG|R!c'\CAG|R!c'\CRc c c $H[[[[[[[["E %( (rL)r6r6rNrr:rLrKBarr s  ,' )rLrN) rrrrrrrrrrrrr:rLrKrsrs s"HK99v[!#)u#)"#)J[!%)%)"%)N[!=)=)"=)~[!])e])"])~[!E)eE)"E)rLrsc`||z ||z }}|||z||zzdzz }|||zz |||zz } }|| fS)z{ Return the point on the line connecting (*x0*, *y0*) -- (*x1*, *y1*) whose distance from (*x0*, *y0*) is *d*. rr:) rBrCrDrErr r ffrrs rK_point_along_a_linerS sS "Wb2gB b2gRB & &B "r'\2R<B r6MrLc2eZdZdZiZGddZGddeZeedGdd eZeed Gd d eZ eed GddeZ eedGddeZ eedGddeZ eedGddeZ eedGddeZeedGddeZeedGd d!eZeed"Gd#d$eZeed%Gd&d'eZeed(Gd)d*eZeed+Gd,d-eZeeGd.d/eZeeGd0d1eZeeGd2d3eZy4)5 ArrowStyleaF `ArrowStyle` is a container class which defines several arrowstyle classes, which is used to create an arrow path along a given path. These are mainly used with `FancyArrowPatch`. An arrowstyle object can be either created as:: ArrowStyle.Fancy(head_length=.4, head_width=.4, tail_width=.4) or:: ArrowStyle("Fancy", head_length=.4, head_width=.4, tail_width=.4) or:: ArrowStyle("Fancy, head_length=.4, head_width=.4, tail_width=.4") The following classes are defined %(ArrowStyle:table)s For an overview of the visual appearance, see :doc:`/gallery/text_labels_and_annotations/fancyarrow_demo`. An instance of any arrow style class is a callable object, whose call signature is:: __call__(self, path, mutation_size, linewidth, aspect_ratio=1.) and it returns a tuple of a `.Path` instance and a boolean value. *path* is a `.Path` instance along which the arrow will be drawn. *mutation_size* and *aspect_ratio* have the same meaning as in `BoxStyle`. *linewidth* is a line width to be stroked. This is meant to be used to correct the location of the head so that it does not overshoot the destination point, but not all classes support it. Notes ----- *angleA* and *angleB* specify the orientation of the bracket, as either a clockwise or counterclockwise angle depending on the arrow type. 0 degrees means perpendicular to the line connecting the arrow's head and tail. .. plot:: gallery/text_labels_and_annotations/angles_on_bracket_arrows.py c0eZdZdZedZdZ ddZy)ArrowStyle._Basea Arrow Transmuter Base class ArrowTransmuterBase and its derivatives are used to make a fancy arrow around a given path. The __call__ method returns a path (which will be used to create a PathPatch instance) and a boolean value indicating the path is open therefore is not fillable. This class is not an artist and actual drawing of the fancy arrow is done by the FancyArrowPatch class. ct|j}t|dk7s2|ddtjk7s|ddtj k7r t dg|dd|ddS)uR Some ArrowStyle classes only works with a simple quadratic Bézier curve (created with `.ConnectionStyle.Arc3` or `.ConnectionStyle.Angle3`). This static method checks if the provided path is a simple quadratic Bézier curve and returns its control points if true. rQrrz,'path' is not a valid quadratic Bezier curve)list iter_segmentsrFrrmrSr)rRsegmentss rKensure_quadratic_bezierz(ArrowStyle._Base.ensure_quadratic_bezier s|D..01HH "hqk!n &CQKNdkk1 BDD5Xa[^5hqk!n5 5rLctd)a The transmute method is the very core of the ArrowStyle class and must be overridden in the subclasses. It receives the *path* object along which the arrow will be drawn, and the *mutation_size*, with which the arrow head etc. will be scaled. The *linewidth* may be used to adjust the path so that it does not pass beyond the given points. It returns a tuple of a `.Path` instance and a boolean. The boolean value indicate whether the path can be filled or not. The return value can also be a list of paths and list of booleans of the same length. rr)rHrRr(r%s rK transmutezArrowStyle._Base.transmute s&&=> >rLcN||jd|gz }t||j}|j|||\}}t j |r6|D cgc]'} t| jd|gz| j)} } | |fS||fS|j|||Scc} w)z The __call__ method is a thin wrapper around the transmute method and takes care of the aspect ratio. r)rjrrirrkiterable) rHrRr(r% aspect_ratiorj path_shrunk path_mutatedfillablerC path_lists rKr)zArrowStyle._Base.__call__ s'==A|+<<"8TZZ8 )- 8E8A*C& h;;x(+7!8%&"&ajjA|3D&Dagg!N!8I!8$h..'11~~dM9EE !8s,B"N)r9)rrrr staticmethodrrr)r:rLrKrr s+   6  6 ?#% FrLrcHeZdZdZdZdxZZ dfd ZdZdZ dZ xZ S) ArrowStyle._Curvea9 A simple arrow which will work with any path instance. The returned path is the concatenation of the original path, and at most two paths representing the arrow head or bracket at the start point and at the end point. The arrow heads can be either open or closed. -Fc d||c|_|_||c|_|_||c|_|_||c|_|_| | c|_|_ d|_ d|_ d|_ d|_ d|jvr td|jj!dd\} } | dk(rd|_ d|_ n-| dk(rd|_ d|_ d|_n| dvrd|_ d|_ | d k(rd|_ d|_ n-| d k(rd|_ d|_ d|_n| d vrd|_ d|_ t& |Qy ) a Parameters ---------- head_length : float, default: 0.4 Length of the arrow head, relative to *mutation_size*. head_width : float, default: 0.2 Width of the arrow head, relative to *mutation_size*. widthA, widthB : float, default: 1.0 Width of the bracket. lengthA, lengthB : float, default: 0.2 Length of the bracket. angleA, angleB : float, default: 0 Orientation of the bracket, as a counterclockwise angle. 0 degrees means perpendicular to the line. scaleA, scaleB : float, default: *mutation_size* The scale of the brackets. Frz-arrow must have the '-' between the two headsrz|>)[rN)rrwidthAwidthBlengthAlengthBrrscaleAscaleB_beginarrow_head_beginarrow_bracket_endarrow_head_endarrow_bracketarrowrro fillbeginfillendr.r/)rHrrrrrrrrrr beginarrowendarrowrJs rKr/zArrowStyle._Curve.__init__ sY*1!Cxc2!Cx#~rCx#~>@N ;;;;;;(K";S8 8rLct||||\}} ddlm} | |||| |\}}} } ||z|| z}} || z||zf||f| | f| | z| |zfg}tjtj tj tj g}|r6t jj|||}|j|}||fS)Nr)get_normal_points) rmatplotlib.bezierrrrmrrrrotate_deg_aroundr)rHrBrCrDrEr=r/r2rrrrrr r rrrQs rK _get_bracketzArrowStyle._Curve._get_bracketL s'r2r26LE5 <.r2ueUKNBBe^Ve^B!BwR0!2h!2h!BwR02N ;;;;;;;;(K "++-??BN!&!@!;. .rLc |js |jr>|j|z}|j|z}t j ||}||z ||z }}|j |n |j } |j|n |j} |jd\} } |jd\} }|jxr | | f| |fk7}|r|j| || | |nggddf\}}}}|jd\}}|jd\}}|jxr ||f||fk7}|r|j|||||nggddf\}}}}tt j| |z| |zfg|jdd||z||zfgg|jg}dg}|r||jrC|jtg|dg|tj|jdn|jt|||jdn|j r|jd\} } |jd\} }|j#| | | ||j$| z|j&| z|j(\}}|jt|||jd|r|j*rF|jd|jtg|dg|tj||fS|jd|jt||||fS|j,r|jd\} } |jd\} }|j#| | | ||j.| z|j0| z|j2\}}|jt|||jd||fS)Nrrr+rFr\T)rrrrrkrrrrjrrrrirrrrr rrrrrrrr)rHrRr(r%rrrrrrrrBrCrDrEhas_begin_arrow verticesAcodesAddxAddyArrx3y3 has_end_arrow verticesBcodesBddxBddyBpathsfillss rKrzArrowStyle._Curve.transmutef s$$(;(;"..> !__}< HH[*= *Y6 Y8Nu&*kk&9]t{{F&*kk&9]t{{F]]1%FB]]1%FB#33LRRH8LO#%%b"b"&/yJ"a^ *IvtT]]2&FB]]2&FB!//HRHR4HM!%%b"b"&/yJ"a^ *IvtT"..BIrDy+A*B*.--"*=,.IrDy+A*B*DE**&'EGE>>LL1y1&13LV3LT^^3LMOLL&LLi!89LL'))q)Bq)B$($5$5b"b"6:kkF6J6:llV6K6:kk%C! 6  T)V45 U#<<LL&LL1y1&13LV3LT^^3LMO %< LL'LLi!89%< ''r*Br*B$($5$5b"b"6:kkF6J6:llV6K6:kk%C! 6  T)V45 U#%< rL) 皙?皙?r9r9rrrrNN) rrrrrrrr/rr rr rs@rK_Curver s9 ## GLNJN < |( 9T /4S rLrrrc"eZdZdZfdZxZS)ArrowStyle.Curvez&A simple curve without any arrow head.c(t|ddy)Nrr)rrr@)rHrJs rKr/zArrowStyle.Curve.__init__ s G   ;rL)rrrrr/r rs@rKCurver s4 < ceZdZdZdZy)ArrowStyle.CurveBz&An arrow with a head at its end point.r%Nr#r:rLrKCurveBr' s 4rLr(<->ceZdZdZdZy)ArrowStyle.CurveABz8An arrow with heads both at the start and the end point.r)Nr#r:rLrKCurveABr+ s FrLr,<|-ceZdZdZdZy)ArrowStyle.CurveFilledAz0An arrow with filled triangle head at the start.r-Nr#r:rLrK CurveFilledAr/ s >rLr0-|>ceZdZdZdZy)ArrowStyle.CurveFilledBz.An arrow with filled triangle head at the end.r1Nr#r:rLrK CurveFilledBr3 s <rLr4<|-|>ceZdZdZdZy)ArrowStyle.CurveFilledABz1An arrow with filled triangle heads at both ends.r5Nr#r:rLrK CurveFilledABr7 s ?rLr8]-c(eZdZdZdZdfd ZxZS)ArrowStyle.BracketAz5An arrow with an outward square bracket at its start.r9c*t||||ya Parameters ---------- widthA : float, default: 1.0 Width of the bracket. lengthA : float, default: 0.2 Length of the bracket. angleA : float, default: 0 degrees Orientation of the bracket, as a counterclockwise angle. 0 degrees means perpendicular to the line. )rrrNr@rHrrrrJs rKr/zArrowStyle.BracketA.__init__  G FGF  KrLr9rrrrrrrr/r rs@rKBracketAr; sC L LrLrB-[c(eZdZdZdZdfd ZxZS)ArrowStyle.BracketBz3An arrow with an outward square bracket at its end.rCc*t||||ya Parameters ---------- widthB : float, default: 1.0 Width of the bracket. lengthB : float, default: 0.2 Length of the bracket. angleB : float, default: 0 degrees Orientation of the bracket, as a counterclockwise angle. 0 degrees means perpendicular to the line. )rrrNr@rHrrrrJs rKr/zArrowStyle.BracketB.__init__ r?rLr@rArs@rKBracketBrE sA L LrLrI]-[c,eZdZdZdZ dfd ZxZS)ArrowStyle.BracketABz3An arrow with outward square brackets at both ends.rJc0t|||||||y)a Parameters ---------- widthA, widthB : float, default: 1.0 Width of the bracket. lengthA, lengthB : float, default: 0.2 Length of the bracket. angleA, angleB : float, default: 0 degrees Orientation of the bracket, as a counterclockwise angle. 0 degrees means perpendicular to the line. rrrrrrNr@)rHrrrrrrrJs rKr/zArrowStyle.BracketAB.__init__ s% G FGF$*GF  LrL)r9rrr9rrrArs@rK BracketABrLsA5645 L LrLrO|-|c(eZdZdZdZdfd ZxZS)ArrowStyle.BarABz/An arrow with vertical bars ``|`` at both ends.rPc0t||d||d|y)aM Parameters ---------- widthA, widthB : float, default: 1.0 Width of the bracket. angleA, angleB : float, default: 0 degrees Orientation of the bracket, as a counterclockwise angle. 0 degrees means perpendicular to the line. rrNNr@)rHrrrrrJs rKr/zArrowStyle.BarAB.__init__#s% G FAf$*Af  FrL)r9rr9rrArs@rKBarABrRs= F FrLrT]->c(eZdZdZdZdfd ZxZS)ArrowStyle.BracketCurveze An arrow with an outward square bracket at its start and a head at the end. rUc*t||||yr=r@r>s rKr/z ArrowStyle.BracketCurve.__init__8r?rLr9rNrArs@rK BracketCurverW0  L LrLrZ<-[c(eZdZdZdZdfd ZxZS)ArrowStyle.CurveBracketze An arrow with an outward square bracket at its end and a head at the start. r\c*t||||yrGr@rHs rKr/z ArrowStyle.CurveBracket.__init__Nr?rLrYrArs@rK CurveBracketr^Fr[rLr`c*eZdZdZdfd ZdZxZS)ArrowStyle.Simpleu:A simple arrow. Only works with a quadratic Bézier curve.cN|||c|_|_|_t|y)aA Parameters ---------- head_length : float, default: 0.5 Length of the arrow head. head_width : float, default: 0.5 Width of the arrow head. tail_width : float, default: 0.2 Width of the arrow tail. Nrr tail_widthr.r/rHrrrerJs rKr/zArrowStyle.Simple.__init__`)Z ?D dot G  rLc2|j|\}}}}}} |j|z} t|| | } ||f||f|| fg} t| | \} }|j |z}t||dz d\}}| (|j|z}t| |dz \}}tj|dftj|dftj|dftj|dftj|dftj|dftj|dftj|dftj|dftj|dftj|dftj|dftj|dfg }nztj|dftj|dftj|dftj|dftj|dftj|dfg}t|Dcgc]\}}| c}}|Dcgc]\}}| c}}}|dfS#t$r3t || ||| \}}d||zzd|| zz}}||f||f|| fg}d} Y9wxYwcc}}wcc}}w)NrrHwmrrrQT)rrrrrrrrrerrrmrSrr)rHrRr(r%rBrCrDrErrrin_f arrow_path arrow_outarrow_inx1ny1nr head_left head_rightre tail_left tail_right patch_pathrrCs rKrzArrowStyle.Simple.transmuteqs%)%A%A$%G "BBB**]:K R5Dr(RHr2h7J !=j$O$ 8=8J$78BRB%P !Iz$!__}< (5i6@2o)G% : ${{JqM:#{{JqM:#{{JqM:#{{JqM:#{{JqM:#{{JqM:#{{IaL9#{{IaL9#{{IaL9#{{IaL9#{{IaL9#{{JqM:#~~z!}=   ${{JqM:#{{JqM:#{{JqM:#{{IaL9#{{IaL9#~~y|<  z2tq!2:4N41aQ4NOD: Y0 !-RR[IB"r'?C27OSHsCj2r(;  !T34NsI" J 6 J 8J  J )rrrrrrrr/rr rs@rKSimplerb\sH "8 rLrwc*eZdZdZdfd ZdZxZS)ArrowStyle.Fancyu9A fancy arrow. Only works with a quadratic Bézier curve.cN|||c|_|_|_t|y)aA Parameters ---------- head_length : float, default: 0.4 Length of the arrow head. head_width : float, default: 0.4 Width of the arrow head. tail_width : float, default: 0.4 Width of the arrow tail. Nrdrfs rKr/zArrowStyle.Fancy.__init__rgrLc|j|\}}}}}} |j|z} ||f||f|| fg} t|| | } t| | \} }|}t|| | dz} t| | \} }| }|j |z}t||dz d\}}|j|z}t||dzddd\}}t|||dz} t| | \}} |d }||}}tj|ftj|d ftj|d ftj|d ftj|d ftj|d ftj|d ftj|d ftj|d ftj|d ftj|d ftj|d ftj|ftj|fg}t|Dcgc]\}}| c}}|Dcgc]\}}| c}}}|d fS#t$r3t || ||| \}}d||zzd|| zz}}||f||f|| fg} | }YwxYwcc}}wcc}}w)NrrrHg333333?rir9r)w1rjw2rrrrQT)rrrrrrrrrerrmrrSr)rHrRr(r%rBrCrDrErrrrlrkpath_outpath_in path_headrorp path_tailrhead_lhead_rrersrt tail_startrrrqrurrCs rKrzArrowStyle.Fancy.transmutes%)%A%A$%G "BBB**]:Kr(RHr2h7J!R5D $$M%&!'$ !Rr)9:D ID!" Hg I=8J01;b468NFF =8J$7 8BR;=##%O !Iz !Rb9D ID!" GX J$*F J;; 3;; 1 6;; 1 6;; 1 6;; 1 6;; 1 6;; 1 6;; ! 5;; ! 5;; ! 5;; ! 5;; ! 5;; 3>>:6Jz2tq!2:4N41aQ4NOD: i0 '-RR[IB"r'?C27OS!2hc RH= &  'd34NsH*> I)  I/ *8I&%I&)rrrrvrs@rKFancyrysG "A rLrc*eZdZdZdfd ZdZxZS)ArrowStyle.Wedgeu Wedge(?) shape. Only works with a quadratic Bézier curve. The start point has a width of the *tail_width* and the end point has a width of 0. At the middle, the width is *shrink_factor*x*tail_width*. c>||_||_t| y)z Parameters ---------- tail_width : float, default: 0.3 Width of the tail. shrink_factor : float, default: 0.5 Fraction of the arrow width at the middle point. N)re shrink_factorr.r/)rHrerrJs rKr/zArrowStyle.Wedge.__init__ s)DO!.D  G  rLc >|j|\}}}}}} ||f||f|| fg} t| |j|zdz |j\} } tj | dftj | dftj | dftj| dftj | dftj | dftj| dfg} t | Dcgc]\}}| c}}| Dcgc]\}}| c}}}|dfScc}}wcc}}w)NrHrirrrQT) rrrerrrmrSrr)rHrRr(r%rBrCrDrErrrlb_plusb_minusrurrCs rKrzArrowStyle.Wedge.transmutes%)%A%A$%G "BBBr(RHr2h7J1$.$(OOm$Cb$H'+'9'9;OFG  ;;q 2;;q 2;;q 2;; 3;; 3;; 3>>71:6 Jz2tq!2:4N41aQ4NOD: 34Ns ' D ; D )rrrvrs@rKrrs  rLrN)rrrrrrrrrr$r(r,r0r4r8rBrIrOrTrZr`rwrrr:rLrKrr_ sa,\KEFEFNa a F[s+<<,<[t,-[t,-[u-&.[u-v.[u-v.[w/0[t,L6L-L$[t,L6L-L$[u-LFL.L*[u-FF.F"[u-LvL.L*[u-LvL.L*[!LL"L\[!UU"Un[!))")rLrceZdZdZdZdZejddddfd ZejddZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZxZS)FancyBboxPatchaO A fancy box around a rectangle with lower left at *xy* = (*x*, *y*) with specified width and height. `.FancyBboxPatch` is similar to `.Rectangle`, but it draws a fancy box around the rectangle. The transformation of the rectangle box to the fancy box is delegated to the style classes defined in `.BoxStyle`. Tc|jjdz}||j|j|j|j fzS)Nz((%g, %g), width=%g, height=%g))rJrrrr0r1rs rKrzFancyBboxPatch.__str__<s; NN # #&G GDGGTWWdkk4<<@@@rLr)mutation_scalemutation_aspectc t|di||\|_|_||_||_|j |||_||_d|_ y)a Parameters ---------- xy : (float, float) The lower left corner of the box. width : float The width of the box. height : float The height of the box. boxstyle : str or `~matplotlib.patches.BoxStyle` The style of the fancy box. This can either be a `.BoxStyle` instance or a string of the style name and optionally comma separated attributes (e.g. "Round, pad=0.2"). This string is passed to `.BoxStyle` to construct a `.BoxStyle` object. See there for a full documentation. The following box styles are available: %(BoxStyle:table)s mutation_scale : float, default: 1 Scaling factor applied to the attributes of the box style (e.g. pad or rounding_size). mutation_aspect : float, default: 1 The height of the rectangle will be squeezed by this value before the mutation and the mutated box will be stretched by the inverse of it. For example, this allows different horizontal and vertical padding. Other Parameters ---------------- **kwargs : `~matplotlib.patches.Patch` properties %(Patch:kwdoc)s TNr:) r.r/rrr0r1 set_boxstyle_mutation_scale_mutation_aspectr) rHrr=r>boxstylerrrIrJs rKr/zFancyBboxPatch.__init__@sWV "6"   (#- / rLc |tjSt|tr t|fi|n||_d|_y)a Set the box style, possibly with further attributes. Attributes from the previous box style are not reused. Without argument (or with ``boxstyle=None``), the available box styles are returned as a human-readable string. Parameters ---------- boxstyle : str or `~matplotlib.patches.BoxStyle` The style of the box: either a `.BoxStyle` instance, or a string, which is the style name and optionally comma separated attributes (e.g. "Round,pad=0.2"). Such a string is used to construct a `.BoxStyle` object, as documented in that class. The following box styles are available: %(BoxStyle:table_and_accepts)s **kwargs Additional attributes for the box style. See the table above for supported parameters. Examples -------- :: set_boxstyle("Round,pad=0.2") set_boxstyle("round", pad=0.2) NT)rrrWr_bbox_transmuterr)rHrrIs rKrzFancyBboxPatch.set_boxstyletsIB  ))+ +(C( X ( (.6  rLc|jS)zReturn the boxstyle object.)rrs rK get_boxstylezFancyBboxPatch.get_boxstylerrLc ||_d|_yzf Set the mutation scale. Parameters ---------- scale : float TNrrrHrKs rKset_mutation_scalez!FancyBboxPatch.set_mutation_scale % rLc|jS)zReturn the mutation scale.rrs rKget_mutation_scalez!FancyBboxPatch.get_mutation_scales###rLc ||_d|_yzz Set the aspect ratio of the bbox mutation. Parameters ---------- aspect : float TNrrrHaspects rKset_mutation_aspectz"FancyBboxPatch.set_mutation_aspect!' rLc6|j |jSdSz-Return the aspect ratio of the bbox mutation.rrrs rKget_mutation_aspectz"FancyBboxPatch.get_mutation_aspect#)-)>)>)J%%  rLc|j}|j}||j|j|z |j|j |z |j }t|jd|gz|jS)z)Return the mutated path of the rectangle.r) rrrrr0r1rrrjri)rHrm_aspectrRs rKrOzFancyBboxPatch.get_pathsw$$&++-8!3 T\\H%<//13DMMQM14::>>rLc|jS)z'Return the left coord of the rectangle.)rrs rKrUzFancyBboxPatch.get_x wwrLc|jS)z)Return the bottom coord of the rectangle.)rrs rKrXzFancyBboxPatch.get_yrrLc|jSrerfrs rKrgzFancyBboxPatch.get_widthrrLc|jSrirjrs rKrkzFancyBboxPatch.get_heightrlrLc ||_d|_y)zo Set the left coord of the rectangle. Parameters ---------- x : float TN)rrrqs rKrrzFancyBboxPatch.set_x rLc ||_d|_y)zq Set the bottom coord of the rectangle. Parameters ---------- y : float TN)rrrus rKrvzFancyBboxPatch.set_yrrLc ||_d|_y)zc Set the rectangle width. Parameters ---------- w : float TNr~rs rKrzFancyBboxPatch.set_widths  rLc ||_d|_y)zd Set the rectangle height. Parameters ---------- h : float TNrrs rKrzFancyBboxPatch.set_heights  rLct|dk(r |d\}}}}n|\}}}}||_||_||_||_d|_y)a Set the bounds of the rectangle. Call signatures:: set_bounds(left, bottom, width, height) set_bounds((left, bottom, width, height)) Parameters ---------- left, bottom : float The coordinates of the bottom left corner of the rectangle. width, height : float The width/height of the rectangle. rrTN)rFrrr0r1rrs rKrzFancyBboxPatch.set_boundssP t9>aJAq!QJAq!Q   rLctjj|j|j|j |j Sr)rr from_boundsrrr0r1rs rKrIzFancyBboxPatch.get_bbox!s4**477DGG+/;; F FrL)rer`)rrrrrrr r r/rrrrrrrOrUrXrgrkrrrvrrrrIr rs@rKrr0sMA1 !111f%%N% $  ?    4FrLrc eZdZdZdZdZejddddddddddd fd Zd Z d Z d Z ejddZ dZ ejddZdZdZdZdZdZdZdZdZxZS)FancyArrowPatcha A fancy arrow patch. It draws an arrow using the `ArrowStyle`. It is primarily used by the `~.axes.Axes.annotate` method. For most purposes, use the annotate method for drawing arrows. The head and tail positions are fixed at the specified start and end points of the arrow, but the size and shape (in display coordinates) of the arrow does not change when the axis is moved or zoomed. Tc |j=|j\\}}\}}t|jd|dd|dd|dd|dd St|jd|jdS)Nz((gz, z)->(z))(r) _posA_posBtyper_path_original)rHrDrErrs rKrzFancyArrowPatch.__str__5s ?? &!% HRhr24j))*"RF"RF$r!fBr!fBO O4j))*!D,?,?+@B BrLNsimplearc3rQr) rR arrowstyleconnectionstylerrrrrrc  | jdtj| jdtjt |di| |#|!|||g|_|d}|j|n| | |d|_n td||_ ||_ ||_ | |_ ||_ |j|| |_| |_d|_y)a **Defining the arrow position and path** There are two ways to define the arrow position and path: - **Start, end and connection**: The typical approach is to define the start and end points of the arrow using *posA* and *posB*. The curve between these two can further be configured using *connectionstyle*. If given, the arrow curve is clipped by *patchA* and *patchB*, allowing it to start/end at the border of these patches. Additionally, the arrow curve can be shortened by *shrinkA* and *shrinkB* to create a margin between start/end (after possible clipping) and the drawn arrow. - **path**: Alternatively if *path* is provided, an arrow is drawn along this Path. In this case, *connectionstyle*, *patchA*, *patchB*, *shrinkA*, and *shrinkB* are ignored. **Styling** The *arrowstyle* defines the styling of the arrow head, tail and shaft. The resulting arrows can be styled further by setting the `.Patch` properties such as *linewidth*, *color*, *facecolor*, *edgecolor* etc. via keyword arguments. Parameters ---------- posA, posB : (float, float), optional (x, y) coordinates of start and end point of the arrow. The actually drawn start and end positions may be modified through *patchA*, *patchB*, *shrinkA*, and *shrinkB*. *posA*, *posB* are exclusive of *path*. path : `~matplotlib.path.Path`, optional If provided, an arrow is drawn along this path and *patchA*, *patchB*, *shrinkA*, and *shrinkB* are ignored. *path* is exclusive of *posA*, *posB*. arrowstyle : str or `.ArrowStyle`, default: 'simple' The styling of arrow head, tail and shaft. This can be - `.ArrowStyle` or one of its subclasses - The shorthand string name (e.g. "->") as given in the table below, optionally containing a comma-separated list of style parameters, e.g. "->, head_length=10, head_width=5". The style parameters are scaled by *mutation_scale*. The following arrow styles are available. See also :doc:`/gallery/text_labels_and_annotations/fancyarrow_demo`. %(ArrowStyle:table)s Only the styles ``<|-``, ``-|>``, ``<|-|>`` ``simple``, ``fancy`` and ``wedge`` contain closed paths and can be filled. connectionstyle : str or `.ConnectionStyle` or None, optional, default: 'arc3' `.ConnectionStyle` with which *posA* and *posB* are connected. This can be - `.ConnectionStyle` or one of its subclasses - The shorthand string name as given in the table below, e.g. "arc3". %(ConnectionStyle:table)s Ignored if *path* is provided. patchA, patchB : `~matplotlib.patches.Patch`, default: None Optional Patches at *posA* and *posB*, respectively. If given, the arrow path is clipped by these patches such that head and tail are at the border of the patches. Ignored if *path* is provided. shrinkA, shrinkB : float, default: 2 Shorten the arrow path at *posA* and *posB* by this amount in points. This allows to add a margin between the intended start/end points and the arrow. Ignored if *path* is provided. mutation_scale : float, default: 1 Value with which attributes of *arrowstyle* (e.g., *head_length*) will be scaled. mutation_aspect : None or float, default: None The height of the rectangle will be squeezed by this value before the mutation and the mutated box will be stretched by the inverse of it. Other Parameters ---------------- **kwargs : `~matplotlib.patches.Patch` properties, optional Here is a list of available `.Patch` properties: %(Patch:kwdoc)s In contrast to other patches, the default ``capstyle`` and ``joinstyle`` for `FancyArrowPatch` are set to ``"round"``. r+r*Nrz.Either posA and posB, or path need to providedr9r:)rrrerr.r/rset_connectionstylerrrrrrset_arrowstylerr_dpi_cor)rHrrrRrrrrrrrrrIrJs rKr/zFancyArrowPatch.__init__<s^ +y7*hnn5 "6"   0T\#TlDO&"(  $ $_ 5 \dlt/?"DOMN N    " J'- / rLcV|||jd<|||jd<d|_y)a Set the start and end positions of the connecting path. Parameters ---------- posA, posB : None, tuple (x, y) coordinates of arrow tail and arrow head respectively. If `None` use current value. NrrT)rr)rHrrs rK set_positionszFancyArrowPatch.set_positionss3  !%DOOA   !%DOOA  rLc ||_d|_y)zn Set the tail patch. Parameters ---------- patchA : `.patches.Patch` TN)rr)rHrs rK set_patchAzFancyArrowPatch.set_patchA  rLc ||_d|_y)zn Set the head patch. Parameters ---------- patchB : `.patches.Patch` TN)rr)rHrs rK set_patchBzFancyArrowPatch.set_patchBrrLc |tjSt|tr t|fi|n||_d|_y)aZ Set the connection style, possibly with further attributes. Attributes from the previous connection style are not reused. Without argument (or with ``connectionstyle=None``), the available box styles are returned as a human-readable string. Parameters ---------- connectionstyle : str or `~matplotlib.patches.ConnectionStyle` The style of the connection: either a `.ConnectionStyle` instance, or a string, which is the style name and optionally comma separated attributes (e.g. "Arc,armA=30,rad=10"). Such a string is used to construct a `.ConnectionStyle` object, as documented in that class. The following connection styles are available: %(ConnectionStyle:table_and_accepts)s **kwargs Additional attributes for the connection style. See the table above for supported parameters. Examples -------- :: set_connectionstyle("Arc,armA=30,rad=10") set_connectionstyle("arc", armA=30, rad=10) NT)rsrrWr _connectorr)rHrrIs rKrz#FancyArrowPatch.set_connectionstylesHB  ""002 2/3/ O 6v 65D  rLc|jS)z"Return the `ConnectionStyle` used.)rrs rKget_connectionstylez#FancyArrowPatch.get_connectionstylerrLc |tjSt|tr t|fi|n||_d|_y)a! Set the arrow style, possibly with further attributes. Attributes from the previous arrow style are not reused. Without argument (or with ``arrowstyle=None``), the available box styles are returned as a human-readable string. Parameters ---------- arrowstyle : str or `~matplotlib.patches.ArrowStyle` The style of the arrow: either a `.ArrowStyle` instance, or a string, which is the style name and optionally comma separated attributes (e.g. "Fancy,head_length=0.2"). Such a string is used to construct a `.ArrowStyle` object, as documented in that class. The following arrow styles are available: %(ArrowStyle:table_and_accepts)s **kwargs Additional attributes for the arrow style. See the table above for supported parameters. Examples -------- :: set_arrowstyle("Fancy,head_length=0.2") set_arrowstyle("fancy", head_length=0.2) NT)rrrWr_arrow_transmuterr)rHrrIs rKrzFancyArrowPatch.set_arrowstylesIB  ++- -*c* z ,V ,0:  rLc|jS)zReturn the arrowstyle object.)rrs rKget_arrowstylezFancyArrowPatch.get_arrowstyleDs%%%rLc ||_d|_yrrrs rKrz"FancyArrowPatch.set_mutation_scaleHrrLc|jS)z\ Return the mutation scale. Returns ------- scalar rrs rKrz"FancyArrowPatch.get_mutation_scaleSs###rLc ||_d|_yrrrs rKrz#FancyArrowPatch.set_mutation_aspect]rrLc6|j |jSdSrrrs rKrz#FancyArrowPatch.get_mutation_aspecthrrLc|j\}}tj|rtj|}|j j j|S)z5Return the path of the arrow in the data coordinates.)_get_path_in_displaycoordrkrrmake_compound_pathrNinvertedr7)rHrrs rKrOzFancyArrowPatch.get_pathmsU88:x ;;x ++U3E!!#,,.==eDDrLc z|j}|j|j|jd}|j|jd}|jj ||f\}}|j |||j |j|j|z|j|z}n)|jj|j}|j||j|z|j|z|j\}}||fS)A patch that connects two points (possibly in different Axes).c|d|jd|jd|jd|jdfzS)Nz#ConnectionPatch((%g, %g), (%g, %g))rr)xy1xy2rs rKrzConnectionPatch.__str__s=4 TXXa[$((1+txx{CD DrLNrrr6g$@F) axesAaxesBrrrrrrrrrc  ||}||_||_||_||_||_||_t |ddd||| | | | | ||d |d|_y)aN Connect point *xyA* in *coordsA* with point *xyB* in *coordsB*. Valid keys are =============== ====================================================== Key Description =============== ====================================================== arrowstyle the arrow style connectionstyle the connection style relpos default is (0.5, 0.5) patchA default is bounding box of the text patchB default is None shrinkA default is 2 points shrinkB default is 2 points mutation_scale default is text size (in points) mutation_aspect default is 1. ? any key for `matplotlib.patches.PathPatch` =============== ====================================================== *coordsA* and *coordsB* are strings that indicate the coordinates of *xyA* and *xyB*. ==================== ================================================== Property Description ==================== ================================================== 'figure points' points from the lower left corner of the figure 'figure pixels' pixels from the lower left corner of the figure 'figure fraction' 0, 0 is lower left of figure and 1, 1 is upper right 'subfigure points' points from the lower left corner of the subfigure 'subfigure pixels' pixels from the lower left corner of the subfigure 'subfigure fraction' fraction of the subfigure, 0, 0 is lower left. 'axes points' points from lower left corner of the Axes 'axes pixels' pixels from lower left corner of the Axes 'axes fraction' 0, 0 is lower left of Axes and 1, 1 is upper right 'data' use the coordinate system of the object being annotated (default) 'offset points' offset (in points) from the *xy* value 'polar' you can specify *theta*, *r* for the annotation, even in cartesian plots. Note that if you are using a polar Axes, you do not need to specify polar for the coordinate system since that is the native "data" coordinate system. ==================== ================================================== Alternatively they can be set to any valid `~matplotlib.transforms.Transform`. Note that 'subfigure pixels' and 'figure pixels' are the same for the parent figure, so users who want code that is usable in a subfigure can use 'subfigure pixels'. .. note:: Using `ConnectionPatch` across two `~.axes.Axes` instances is not directly compatible with :ref:`constrained layout `. Add the artist directly to the `.Figure` instead of adding it to a specific Axes, or exclude it from the layout using ``con.set_in_layout(False)``. .. code-block:: default fig, ax = plt.subplots(1, 2, constrained_layout=True) con = ConnectionPatch(..., axesA=ax[0], axesB=ax[1]) fig.add_artist(con) Nr\r^) rrrrrrrrrrrr:) rrcoords1coords2rrr.r/_annotation_clip)rHxyAxyBcoordsAcoordsBrrrrrrrrrrrrIrJs rKr/zConnectionPatch.__init__s}b ?G      #f6$.)8 &v!('(6)8!( #" #!%rLc|}| |j}tj|d}tj|d}|jd}|dvr7||jzdz }||jzdz }|j dd}n5|d k(r |j }n#|d k(r |j}n|d k(r |j}|d k(r{|j}tj|jj|}tj|jj|}|j||fS|d k(rt|j d k(r|j#|j$d S|j#|j$|j ||jdjzdz zS|dk(rS||} } | tj&| z}| tj(| z}|j}|j||fS|dk(rf|jdj*} |dk\r| j,|zn| j.|z}|dk\r| j0|zn| j2|z}||fS|dk(rf|jdj4} |dk\r| j,|zn| j.|z}|dk\r| j0|zn| j2|z}||fS|dk(rV|j4} |dk\r| j,|zn| j.|z}|dk\r| j0|zn| j2|z}||fSt7|t8j:r|j|St=|d)z,Calculate the pixel position of given point.rrFr)z figure pointsz axes pointsHrypixelszfigure fractionzsubfigure fractionz axes fractiondataz offset pointsTpolarz figure pixelszsubfigure pixelsz axes pixelsz) is not a valid coordinate transformation)rrkr,rdpir transFiguretransSubfigure transAxes transDatar _to_unmasked_float_arrayxaxis convert_unitsyaxisrxycoords_get_xyrrrfigbboxrBrDrCrErMrWr Transformr) rHrrrs0rbrcfigrQrrbbs rKr zConnectionPatch._get_xys  <99D HHRUO HHRUOoo5o) 0 0CGG b ACGG b A (H-A # #A & &""A / !A ;NNE..tzz/G/G/JKA..tzz/G/G/JKA??Aq6* * / !}}/||DGGV44 TWWdmm4tD1555:; <'\!1EBFF5M!ABFF5M!ANNE??Aq6* * / !e,44B!V A!V Aa4K $ $e,11B!V A!V Aa4K - B!V A!V Aa4K :// 0;;r? "t#LMN NrLc ||_d|_y)a Set the annotation's clipping behavior. Parameters ---------- b : bool or None - True: The annotation will be clipped when ``self.xy`` is outside the Axes. - False: The annotation will always be drawn. - None: The annotation will be clipped when ``self.xy`` is outside the Axes and ``self.xycoords == "data"``. TN)rrrs rKset_annotation_clipz#ConnectionPatch.set_annotation_clipRs!" rLc|jS)zx Return the clipping behavior. See `.set_annotation_clip` for the meaning of the return value. )rrs rKget_annotation_clipz#ConnectionPatch.get_annotation_clipbs $$$rLc |j}|j|j|j|j}|j|j |j |j}|j|||j|j|j|z|j|z}|j||j|z|j|z|j!\}}||fS)rr)rr rrrrrrrrrrrrrrZr)rHrrrrRrs rKrz)ConnectionPatch._get_path_in_displaycoordjs--||DHHdllDJJ?||DHHdllDJJ?)t'') $;;t{{LL7*DLL74J  /,,.   # # % /    7 *  $ $ &  h X~rLc|j}|s|w|jdk(rh|j|j|j|j}|j |j }n |j}|j |sy|s|w|jdk(rh|j|j|j|j}|j |j }n |j}|j |syy)z/Check whether the annotation needs to be drawn.rFT) rrr rrrrarrr)rHrrxy_pixelrs rK _check_xyzConnectionPatch._check_xy|s  $ $ & t||v5||DHHdllDJJGHzz!yyzz&&x0 t||v5||DHHdllDJJGHzz!yyzz&&x0rLch|jr|j|syt| |yr`)rrr.rr*s rKrzConnectionPatch.draws)!)A   XrLr`)rrrrrr r r/r rrrrrr rs@rKrrstHDe%4!' #!%e%e%N<O| %$2rLrr)rNr`)Mrrrr6numbersrrrtypesr collectionsrmatplotlib.transformsrnumpyrk matplotlibr3rr r r r r rrrrrbezierrrrrrrrrrRr_enumsrrr define_aliasesrr'rr,rrrrrrrrrgetdocr/ splitlinesr;rCrerrrrrrrrsrrrrrr:rLrKr#s !"*,,,AAA' 6 r FMMr r j9U9xV"V"r.!U.!b8j jZ`Ee`EFSESnPEPfffR yy  ++ , 2>>@DFG DND2q'eq'hxexv'.W'.Ts7's7l. S&S&l$ i-vi-i-X  V)fV)V)r  M M M `tFUtFn{/e{/| sosrL