rL i=ddlmZddlZddlmZmZmZddlZddlmZm Z ddl Z ddl m Z m Z ddlZddlZddlZddlZddlZddlmZmZddlmZdd lmZmZmZmZmZm Z m!Z!e jDe#Z$d Z%d Z&d Z'd Z(eddZ)GddZ*e*Z+GddZ,dZ-GddZ.ddZ/e/Z0dddZ1dZ2e,jgy)) namedtupleN)cachereducewraps) Signature Parameter)NumberReal)_apicbook)Path)BboxBaseBboxIdentityTransform TransformTransformedBboxTransformedPatchPathTransformedPathc<tfd}d|_|S)Nc|jdk(r#|jr|jd|_||g|i|S)NrF) _raster_depth _rasterizingstop_rasterizing)artistrendererargskwargsdraws W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/matplotlib/artist.py draw_wrapperz,_prevent_rasterization..draw_wrappersF  ! !Q &8+@+@  % % '$)H !FH6t6v66Fr_supports_rasterizationrr!s` r _prevent_rasterizationr&s+ 4[77,1L( r"c<tfd}d|_|S)a- Decorator for Artist.draw method. Provides routines that run before and after the draw call. The before and after functions are useful for changing artist-dependent renderer attributes or making other setup function calls, such as starting and flushing a mixed-mode renderer. c |jrH|jdk(r#|js|jd|_|xjdz c_n2|jdk(r#|jr|j d|_|j |j |||j |j|j |jr|xjdzc_|jrC|jdx}r.|jr!|j |jSSSS#|j |j|j |jr|xjdzc_|jrC|jdx}r.|jr!|j |jwwwwxYw)NrTr Froot) get_rasterizedrrstart_rasterizingrget_agg_filter start_filter stop_filter get_figuresuppressComposite)rrfigrs r r!z)allow_rasterization..draw_wrapper5s -$$&))Q.x7L7L..0,0H)&&!+&))Q.83H3H--/,1H)$$&2%%')$$&2$$V%:%:%<=$$&&&!+&%%&2C2C2C2N+N3+N))))+**,*,O% $$&2$$V%:%:%<=$$&&&!+&%%&2C2C2C2N+N3+N))))+**,*,O%s B2EB%G>Tr#r%s` r allow_rasterizationr3,s+ 4[--:,0L( r"c.tfd}|S)z Decorator for Artist.draw method. Needed on the outermost artist, i.e. Figure, to finish up if the render is still in rasterized mode. ch||g|i|}|jr|jd|_|S)NF)rr)rrrrresultrs r r!z-_finalize_rasterization..draw_wrapper\s;fh888   % % '$)H ! r")rr%s` r _finalize_rasterizationr7Ws#  4[ r"c@|jr||j_yyN)axesstaleselfvals r _stale_axes_callbackr?fs yy r"_XYPairzx yceZdZdZy)_Unsetcy)Nzr=s r __repr__z_Unset.__repr__osr"N)__name__ __module__ __qualname__rFrDr"r rBrBnsr"rBceZdZdZdZdZgdZedZdZ dZ dZ d Z d Z d Zed Zej"d ZedZej"dZdVdZdVdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(dWd'Z)d(Z*d)Z+dXd*Z,d+Z-ee,e-d,-Z.d.Z/dVd/Z0d0Z1d1Z2d2Z3d3Z4d4Z5d5Z6d6Z7d7Z8d8Z9d9Z:d:Z;d;Zd>Z?d?Z@d@ZAdAZBdBZCdCZDdDZEdEZFdFZGdGZHdHZIedIZJdJZKdKZLdLZMdMZNdNZOdOZPeQjdPZSdYdQZTdRZUdSZVdTZWdUZXeeWeXZYy)ZArtistz Abstract base class for objects that render into a FigureCanvas. Typically, all visible elements in a figure are subclasses of Artist. rc t|jdst|j|_t|jdsyd|_d|j_|j d|j_|j y)Nr$_autogenerated_signaturec.tj|fi|Sr9)rKsetr=rs r z*Artist.__init_subclass__..sD)CF)Cr"rOz.set)hasattrrr&rOrGrI#_update_set_signature_and_docstring)clss r __init_subclass__zArtist.__init_subclass__}srsxx!:;-chh7CH sww :; C "%"2"2!348 //1r") navigate_modefigure 3d_propertiesc ~ttdtjgt|j Dcgc]4}|t j vr t|tjt6c}|j_ d|j_ dt|z|j_ ycc}w)z Update the signature of the set function to list all properties as keyword arguments. Property aliases are not listed in the signature for brevity, but are still accepted as keyword arguments. r=)defaultTz> ? E*3/;;=DfBBBy55vFD E!F ,0( +Cj   Ds9B: chd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_t!|j"t$j"k7|_t)j*dg|_ d|_d|_d|_d|_d|_t:j<d|_t:j<d|_ tCgg|_"d|_#y#t0$rYpwxYw)NTFpchanged)signalsz path.sketchz path.effects)$_stalestale_callback_axes_parent_figure _transform _transformSet_visible _animated_alphaclipbox _clippath_clipon_label_picker _rasterized _agg_filtertypeget_cursor_datarK _mouseoverr CallbackRegistry _callbacksr:AttributeError_remove_method_url_gid_snapmplrcParams_sketch _path_effectsr@ _sticky_edges _in_layoutrEs r __init__zArtist.__init__s " ""       t*448N8NN00*F DI#   ||M2  \\.9$R_   s9D%% D10D1cD|jj}d|d<|S)Nrj)__dict__copy)r=ds r __getstate__zArtist.__getstate__s$ MM   " r"c^|j|j|d|_d}t|drK|jr?|jjj |d|j_d|_d}|jdx}|sd|_d|_yytd)a Remove the artist from the figure if possible. The effect will not be visible until the figure is redrawn, e.g., with `.FigureCanvasBase.draw_idle`. Call `~.axes.Axes.relim` to update the Axes limits if desired. Note: `~.axes.Axes.relim` will not see collections even if the collection was added to the Axes with *autolim* = True. Note: there is no support for removing the artist's legend entry. NFr:Tr)zcannot remove artist) rrjrRr:_mouseover_setdiscardr;r0rlNotImplementedError)r=_ax_flagr2s r removez Artist.removes$    *    %"&D HtV$ ((006"&   E22? $CI&*#@ &&<= =r"cv|j}|xr*td|jjDS)z)Return whether units are set on any axis.c3<K|]}|jywr9) have_units).0axiss r z$Artist.have_units.. sN$//+Ns)r:any _axis_mapvalues)r=axs r rzArtist.have_unitss. YYNcN 8K8K8MNNNr"crt|dd}| |j|S|jj|S)z Convert *x* using the unit type of the xaxis. If the artist is not contained in an Axes or if the xaxis does not have units, *x* itself is returned. r:N)getattrxaxis convert_units)r=xrs r convert_xunitszArtist.convert_xunits :T64 ( :)Hxx%%a((r"crt|dd}| |j|S|jj|S)z Convert *y* using the unit type of the yaxis. If the artist is not contained in an Axes or if the yaxis does not have units, *y* itself is returned. r:N)ryaxisr)r=yrs r convert_yunitszArtist.convert_yunitsrr"c|jS)z>  4&&2   c *33r"Nc$tddgddggS)a Get the artist's bounding box in display space. The bounding box' width and height are nonnegative. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0. Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the Axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly. r)rr=rs r get_window_extentzArtist.get_window_extentHs$aVaV$%%r"c(|j|}|jrp|j}|tj||}|j }|6|4|j }tj||j}|S)a Like `.Artist.get_window_extent`, but includes any clipping. Parameters ---------- renderer : `~matplotlib.backend_bases.RendererBase` subclass, optional renderer that will be used to draw the figures (i.e. ``fig.canvas.get_renderer()``) Returns ------- `.Bbox` or None The enclosing bounding box (in figure pixel coordinates). Returns None if clipping results in no intersection. )r get_clip_on get_clip_boxr intersection get_clip_pathget_fully_transformed_path get_extents)r=rbboxclip_box clip_paths r get_tightbboxzArtist.get_tightbbox\s %%h/    ((*H#((x8**,I$)9%@@B ((y/D/D/FG r"cFjjdfdS)a Add a callback function that will be called whenever one of the `.Artist`'s properties changes. Parameters ---------- func : callable The callback function. It must have the signature:: def func(artist: Artist) -> Any where *artist* is the calling `.Artist`. Return values may exist but are ignored. Returns ------- int The observer id associated with the callback. This id can be used for removing the callback with `.remove_callback` later. See Also -------- remove_callback rgcSr9rD)funcr=sr rQz%Artist.add_callback..s 4:r")r}connect)r=rs``r add_callbackzArtist.add_callbackws6&&z3EFFr"c:|jj|y)zu Remove a callback based on its observer id. See Also -------- add_callback N)r} disconnect)r=oids r remove_callbackzArtist.remove_callbacks ""3'r"c:|jjdy)z Call all of the registered callbacks. This function is triggered internally when a property is changed. See Also -------- add_callback remove_callback rgN)r}processrEs r rgzArtist.pchangeds  +r"c|jS)z Return whether the Artist has an explicitly set transform. This is *True* after `.set_transform` has been called. )rnrEs r is_transform_setzArtist.is_transform_sets !!!r"cN||_d|_|jd|_y)z Set the artist transform. Parameters ---------- t : `~matplotlib.transforms.Transform` TN)rmrnrgr;)r=ts r set_transformzArtist.set_transforms#!  r"c|jt|_|jSt|jts@t |jdr*|jj |j |_|jS)z5Return the `.Transform` instance used by this artist._as_mpl_transform)rmr isinstancerrRrr:rEs r get_transformzArtist.get_transformse ?? "/1DOT__i8$//+>?"oo?? JDOr"cgS)z9Return a list of the child `.Artist`\s of this `.Artist`.rDrEs r get_childrenzArtist.get_childrens r"ct|ddduxr0|jdx}duxr|j|juS)a Check whether an *event* occurred on a canvas other that this artist's canvas. If this method returns True, the event definitely occurred on a different canvas; if it returns False, either it occurred on the same canvas, or we may not have enough information to know. Subclasses should start their definition of `contains` as follows:: if self._different_canvas(mouseevent): return False, {} # subclass-specific implementation follows canvasNTr))rr0r)r=eventr2s r _different_canvaszArtist._different_canvassLx.d:3 OOO66StC3LL 2 4r"c^tjd|jjdifS)a Test whether the artist contains the mouse event. Parameters ---------- mouseevent : `~matplotlib.backend_bases.MouseEvent` Returns ------- contains : bool Whether any values are within the radius. details : dict An artist-specific dictionary of details of the event context, such as which points are contained in the pick radius. See the individual Artist subclasses for details. z%r needs 'contains' methodF)_logwarning __class__rG)r= mouseevents r containszArtist.containss'" 14>>3J3JKbyr"cJ|jdduxr|jduS)z Return whether the artist is pickable. See Also -------- .Artist.set_picker, .Artist.get_picker, .Artist.pick Fr)N)r0rvrEs r pickablezArtist.pickables(E*$6S4<:&&'uT)_-E-E,FHI I  r"c|jS)zc Return the alpha value used for blending - not supported on all backends. )rqrEs r get_alphazArtist.get_alphaNs {{r"c|jS)zReturn the visibility.)rorEs r get_visiblezArtist.get_visibleUs }}r"c|jS)z&Return whether the artist is animated.)rprEs r get_animatedzArtist.get_animatedY ~~r"c|jS)z Return boolean flag, ``True`` if artist is included in layout calculations. E.g. :ref:`constrainedlayout_guide`, `.Figure.tight_layout()`, and ``fig.savefig(fname, bbox_inches='tight')``. rrEs r get_in_layoutzArtist.get_in_layout]sr"c|j}|j}|jduxr|jxr|duxs|duxr|duxs@t j |j |jjj k(xr:|duxs4t|txr"|j|jjuS)at Return a boolean flag, ``True`` if the artist is clipped to the Axes and can thus be skipped in layout calculations. Requires `get_clip_on` is True, one of `clip_box` or `clip_path` is set, ``clip_box.extents`` is equivalent to ``ax.bbox.extents`` (if set), and ``clip_path._patch`` is equivalent to ``ax.patch`` (if set). N) rrr:rnpallextentsrrr_patchpatch)r=rrs r _fully_clipped_to_axeszArtist._fully_clipped_to_axeshs$$&&&(  %>$$&>T)BYd-B>%Kx//499>>3I3IIJ > $&="9.BC="))TYY__< ?r"c|jS)z(Return whether the artist uses clipping.)rtrEs r rzArtist.get_clip_on ||r"c|jS)zReturn the clipbox.rrEs r rzArtist.get_clip_boxr6r"c|jS)zReturn the clip path.)rsrEs r rzArtist.get_clip_pathr*r"cP|j|jjSy)z Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation. )NN)rsget_transformed_path_and_affinerEs r $get_transformed_clip_path_and_affinez+Artist.get_transformed_clip_path_and_affines$ >> %>>AAC Cr"c@||_|jd|_y)z Set whether the artist uses clipping. When False, artists will be visible outside the Axes which can lead to unexpected results. Parameters ---------- b : bool TN)rtrgr;r=bs r set_clip_onzArtist.set_clip_ons   r"c|jrC|j|j|j|j|jy|jd|jdy)z!Set the clip properly for the gc.N)rtrrset_clip_rectangler#rs)r=gcs r _set_gc_clipzArtist._set_gc_clipsS <<||'%%dll3   T^^ ,  ! !$ '   T "r"c|jS)z.Return whether the artist is to be rasterized.)rwrEs r r+zArtist.get_rasterizedr"czt|jdd}|r|stjd|d||_y)a Force rasterized (bitmap) drawing for vector graphics output. Rasterized drawing is not supported by all artists. If you try to enable this on an artist that does not support it, the command has no effect and a warning will be issued. This setting is ignored for pixel-based output. See also :doc:`/gallery/misc/rasterization_demo`. Parameters ---------- rasterized : bool r$FzRasterization of 'z' will be ignoredN)rrr warn_externalrw)r= rasterizedsupports_rasterizations r set_rasterizedzArtist.set_rasterizedsB "))BE"K 4   !3D69JK L%r"c|jS)z1Return filter function to be used for agg filter.)rxrEs r r-zArtist.get_agg_filterrEr"c ||_d|_y)a Set the agg filter. Parameters ---------- filter_func : callable A filter function, which takes a (m, n, depth) float array and a dpi value, and returns a (m, n, depth) array and two offsets from the bottom left corner of the image .. ACCEPTS: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image TN)rxr;)r= filter_funcs r set_agg_filterzArtist.set_agg_filters' r"c4|jsyd|_y)a| Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible (`.Artist.get_visible` returns False). Parameters ---------- renderer : `~matplotlib.backend_bases.RendererBase` subclass. Notes ----- This method is overridden in the Artist subclasses. NF)r'r;rs r rz Artist.draws!  r"c|'t|tstdt||d|cxkrdksnt d|d||j k7r||_|j d|_yy)z Set the alpha value used for blending - not supported on all backends. Parameters ---------- alpha : float or None *alpha* must be within the 0-1 range, inclusive. Nz#alpha must be numeric or None, not rr zalpha (z) is outside 0-1 rangeT)rr rryrrqrgr;r=alphas r set_alphazArtist.set_alphas}  Zt%<5d5k]CE E  a5oAowug-CDE E DKK DK MMODJ r"ct|tr tdtj|st j ||ytj|}d|jkr|jdks-td|jd|j||_ |jd|_ y)a! Set the alpha value used for blending - not supported on all backends. Parameters ---------- alpha : array-like or float or None All values must be within the 0-1 range, inclusive. Masked values and nans are not supported. z+alpha must be numeric or None, not a stringNrr z5alpha must be between 0 and 1, inclusive, but min is z , max is T)rstrrr/iterablerKrSasarrayminmaxrrqrgr;rQs r _set_alpha_for_arrayzArtist._set_alpha_for_arrays eS !IJ J{{5!   T5 )  5!UYY[ UYY[A%5++099;-y OP P   r"c`||jk7r||_|jd|_yy)zf Set the artist's visibility. Parameters ---------- b : bool TN)rorgr;r=s r set_visiblezArtist.set_visibles,  DM MMODJ r"cR|j|k7r||_|jyy)a Set whether the artist is intended to be used in an animation. If True, the artist is excluded from regular drawing of the figure. You have to call `.Figure.draw_artist` / `.Axes.draw_artist` explicitly on the artist. This approach is used to speed up animations using blitting. See also `matplotlib.animation` and :ref:`blitting`. Parameters ---------- b : bool N)rprgr=s r set_animatedzArtist.set_animated,s% >>Q DN MMO r"c||_y)a Set if artist is to be included in layout calculations, E.g. :ref:`constrainedlayout_guide`, `.Figure.tight_layout()`, and ``fig.savefig(fname, bbox_inches='tight')``. Parameters ---------- in_layout : bool Nr,)r= in_layouts r set_in_layoutzArtist.set_in_layout@s $r"c|jS)z4Return the label used for this artist in the legend.)rurEs r get_labelzArtist.get_labelM {{r"c~| t|nd}||jk7r||_|jd|_yy)z Set a label that will be displayed in the legend. Parameters ---------- s : object *s* will be converted to a string by calling `str`. NT)rUrurgr;)r=slabels r set_labelzArtist.set_labelQs;-AT DKK DK MMODJ r"c|jS)zReturn the artist's zorder.)zorderrEs r get_zorderzArtist.get_zorder`rdr"c||jj}||jk7r||_|jd|_yy)z Set the zorder for the artist. Artists with lower zorder values are drawn first. Parameters ---------- level : float NT)rrjrgr;)r=levels r set_zorderzArtist.set_zorderds@ =NN))E DKK DK MMODJ r"c|jS)a ``x`` and ``y`` sticky edge lists for autoscaling. When performing autoscaling, if a data limit coincides with a value in the corresponding sticky_edges list, then no margin will be added--the view limit "sticks" to the edge. A typical use case is histograms, where one usually expects no margin on the bottom edge (0) of the histogram. Moreover, margin expansion "bumps" against sticky edges and cannot cross them. For example, if the upper data limit is 1.0, the upper view limit computed by simple margin application is 1.2, but there is a sticky edge at 1.1, then the actual upper view limit will be 1.1. This attribute cannot be assigned to; however, the ``x`` and ``y`` lists can be modified in place as needed. Examples -------- >>> artist.sticky_edges.x[:] = (xmin, xmax) >>> artist.sticky_edges.y[:] = (ymin, ymax) )rrEs r sticky_edgeszArtist.sticky_edgests2!!!r"cr|j|_|j|_|j|_|j|_|j|_|j |_|j |_|j|_|j|_|j|_ |jjj|jjdd|jjj|jjdd|jd|_y)z'Copy properties from *other* to *self*.NT)rmrnrorqrrrtrsrurrrprrrrgr;)r=others r update_fromzArtist.update_froms**"00 ll }} }} ll }} "00!&!3!3!5!5!:!:!<A!&!3!3!5!5!:!:!<A  r"c4t|jS)z8Return a dictionary of all the properties of the artist.)r\ propertiesrEs r ruzArtist.propertiesst$//11r"c g}tj|d5|jD]\}}|dk(r|jt |||(t |d|d}t |s't|jt||||j|| ddd|r|jd|_ |S#1swY$xYw) z Helper for `.Artist.set` and `.Artist.update`. *errfmt* is used to generate error messages for invalid property names; it gets formatted with ``type(self)`` for "{cls}" and the property name for "{prop_name}". F)eventsonr:set_N)rT prop_name)nameT) r _setattr_cmitemsappendsetattrrrr~formatryrgr;)r=propserrfmtretkvrs r _update_propszArtist._update_propss   te 4 ( (1;JJwtQ23"44sT:D#D>,"MMd4jAMF!"$$JJtAw' ( (  MMODJ ! ( (s BCCc&|j|dS)z Update this artist's properties from the dict *props*. Parameters ---------- props : dict z5{cls.__name__!r} object has no property {prop_name!r}r)r=rs r updatez Artist.updates!! JL Lr"c&|j|dS)z Update artist properties without prenormalizing them, but generating errors as if calling `set`. The lack of prenormalization is to maintain backcompatibility. zE{cls.__name__}.set() got an unexpected keyword argument {prop_name!r}rrPs r _internal_updatezArtist._internal_updates!!  r"c L|jtj||Sr9)rr normalize_kwargsrPs r rOz Artist.sets"$$U%;%;FD%IJJr"c +K|Dcic]}|t|d|}} |jdi|d|jdi|ycc}w#|jdi|wxYww)zV `.Artist.set` context-manager that restores original values at exit. get_NrD)rrO)r=rr orig_valss r _cm_setzArtist._cm_setsx >DDQ1QCj133D D " DHH v   DHH !y ! E DHH !y !s%A+AA+AA+A((A+c ^d}n?ttrttrfd}nt r}n t dt tj|jDcgc]}|j|c}g}|r||r|j||Scc}w)a Find artist objects. Recursively find all `.Artist` instances contained in the artist. Parameters ---------- match A filter criterion for the matches. This can be - *None*: Return all objects contained in artist. - A function with signature ``def match(artist: Artist) -> bool``. The result will only contain artists for which the function returns *True*. - A class instance: e.g., `.Line2D`. The result will only contain artists of this class or its subclasses (``isinstance`` check). include_self : bool Include *self* in the list to be checked for a match. Returns ------- list of `.Artist` cyNTrD)rs r matchfuncz!Artist.findobj..matchfuncsr"ct|Sr9)r)rmatchs r rz!Artist.findobj..matchfuncs!!U++r"zFmatch must be None, a matplotlib.artist.Artist subclass, or a callable) rry issubclassrKrrroperatoriaddrfindobjr})r=r include_selfrcartistss ` r rzArtist.findobjs4 =  t $E6)B , e_I78 88<8I8I8KL1!))I.LbR IdO NN4 Ms-B* cy)a Return the cursor data for a given event. .. note:: This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself. Cursor data can be used by Artists to provide additional context information for a given event. The default implementation just returns *None*. Subclasses can override the method and return arbitrary data. However, when doing so, they must ensure that `.format_cursor_data` can convert the data to a string representation. The only current use case is displaying the z-value of an `.AxesImage` in the status bar of a plot window, while moving the mouse. Parameters ---------- event : `~matplotlib.backend_bases.MouseEvent` See Also -------- format_cursor_data NrD)r=rs r rzzArtist.get_cursor_datas:r"ctj|dk(rt|dr|j|S |ddj d|D}d|zdzS#tt f$r|g}Y4wxYw)ac Return a string representation of *data*. .. note:: This method is intended to be overridden by artist subclasses. As an end-user of Matplotlib you will most likely not call this method yourself. The default implementation converts ints and floats and arrays of ints and floats into a comma-separated string enclosed in square brackets, unless the artist has an associated colorbar, in which case scalar values are formatted using the colorbar's formatter. See Also -------- get_cursor_data r_format_cursor_data_overridez, c3DK|]}t|tr|dyw)z0.3gN)rr )ritems r rz,Artist.format_cursor_data..Ns'!>D$.tV$<%);!>s [])r/ndimrRrr IndexErrorjoin)r=datadata_strs r format_cursor_datazArtist.format_cursor_data2s$ 774=A '$0N"O44T: : Qyy!>D!>>H>C' ' z* v sAA10A1c|jS)z Return whether this artist is queried for custom context information when the mouse cursor moves over it. )r{rEs r get_mouseoverzArtist.get_mouseoverRs r"ct||_|j}|rD|jr|jj |y|jj |yy)a3 Set whether this artist is queried for custom context information when the mouse cursor moves over it. Parameters ---------- mouseover : bool See Also -------- get_cursor_data .ToolCursorPosition .NavigationToolbar2 N)boolr{r:raddr)r= mouseoverrs r set_mouseoverzArtist.set_mouseoverYsOy/ YY !!%%d+!!))$/ r"r9)NNN)Fr)ZrGrHrIrcrjrUr^ classmethodrSrrrrrrpropertyr:setterr;rrrrrgrrrrrrrrrrrrrrrrrr r rr0rrWrr#r%r'r)r-r4rrrr;r?rCr+rJr-rNrrSrZr\r^rarcrhrkrnrprsrurrrrO contextlibcontextmanagerrrrzrrrrrDr"r rKrKtsI F24%!("H $>VO ) ) [[77 \\ + +&(6G:( ," 4$(T$#L!F  8(8 " #0j*CEF$<| ?0"# &. $&&. ( $  ""4"26 L K  " "*X>(@0. 6Ir"rKcv |j|ii|ddiS#t$r|j|i|cYSwxYw)z Matplotlib's `.Axes.get_tightbbox` and `.Axis.get_tightbbox` support a *for_layout_only* kwarg; this helper tries to use the kwarg but skips it when encountering third-party subclasses that do not support it. for_layout_onlyT)rr)objrrs r _get_tightbbox_for_layout_onlyrssT 2 s  $N*MV*M5F*MNN 2 s  $1&112s 88ceZdZdZdZdZejdZdZ dZ dZ e e dZe e d Zd Zhd Zd ZddZddZdZdZy )r\z A helper class to inspect an `~matplotlib.artist.Artist` and return information about its settable properties and their current values. ct|ts0tj|rt |}t |r|d}||_t|ts t|}||_|j|_ y)a Initialize the artist inspector with an `Artist` or an iterable of `Artist`\s. If an iterable is used, we assume it is a homogeneous sequence (all `Artist`\s are of the same type) and it is your responsibility to make sure this is so. rN) rrKr/rVlistlenoorigryo get_aliasesaliasd)r=rs r rzArtistInspector.__init__sc!V${{1~Gq6!A !T"QA&&( r"c t|jDcgc]4}|jdr!tt |j|r|6}}i}|D]}t |j|}|j |s+t jd|dddtj|jd}|j|ddtj|dd|Scc}w)a  Get a dict mapping property fullnames to sets of aliases for each alias in the :class:`~matplotlib.artist.ArtistInspector`. e.g., for lines:: {'markerfacecolor': {'mfc'}, 'linewidth' : {'lw'}, } )rxrz`(Nz.*)`r )dirr startswithrris_aliasresearchinspectgetdocgroup setdefaultrOr)r=rznamesaliasesrpropnames r rzArtistInspector.get_aliasess#&dff+9$OO$45 !6799 BD4664(D==&yy2d2AhZt!4!(!577  66&#u{{1~6 6]]..q1  Z |7;YG ;;q> !r"cdddd}|jD]\}}|j||}|S)z Changes the full path to the public API path that is used in sphinx. This is needed for links to work. Axes)_base._AxesBase _axes.Axes)r|replace)r= source_class replace_dictkeyvalues r _replace_pathzArtistInspector._replace_pathsE ,2&,. &,,. .sO1(Q,Os)rsortedrget)r=rfrs r aliased_namezArtistInspector.aliased_name s6''Ot{{q"7M0NOO7{r"> $matplotlib.image._ImageBase.set_data%matplotlib.image._ImageBase.set_alpha%matplotlib.image._ImageBase.set_array(matplotlib.image._ImageBase.set_resample)matplotlib.image._ImageBase.set_filterrad*matplotlib.image._ImageBase.set_filternorm-matplotlib.image._ImageBase.set_interpolation3matplotlib.image._ImageBase.set_interpolation_stage3matplotlib.text._AnnotationBase.set_annotation_clipc |jvrd|dSdjfdt|jj |gD}d|dd|S)a: Return 'PROPNAME or alias' if *s* has an alias, else return 'PROPNAME', formatted for reST. For example, for the line markerfacecolor property, which has an alias, return 'markerfacecolor or mfc' and for the transform property, which does not, return 'transform'. z``rfc30K|] }d|ddyw)z or :meth:` <>`NrD)rrtargets r rz4ArtistInspector.aliased_name_rest..5s'S./k!Bvhb )Ssz:meth:`rr) _NOT_LINKABLErrrr)r=rfrrs ` r aliased_name_restz!ArtistInspector.aliased_name_rest(sl T'' 's": ''S39$++//!R:P3QSS2fXRy11r"Nc|rd|z}nd}||j|}||d|Sg}t|jD]<}|j|}|j|}|j ||d|>|S)a If *prop* is *None*, return a list of strings of all settable properties and their valid values. If *prop* is not *None*, it is a valid property name and that property will be returned as a string of property : valid values. rrf: )rrr]rr})r=rd leadingspacepadacceptslinesrzs r pprint_setterszArtistInspector.pprint_setters9s  $CC  ++D1GU4&7), ,4++-. 4D++D1G$$T*D LLC5b 2 3 4 r"c |rd|z}nd}||j|}||d|Sg}t|jD]}|jjD]#}t |d|d}|s|j #nt |jd|}|j||jd|jf|Dcgc]7\}}|j||jddjd d9} }}|D cgc]\}} |j|}}} td | D} td |D} |d zd | zzd zd | zz} d|dz|dzd| |d zdj| zd zdj| z| gt| |Dcgc]1\}}|d z|j| zd z|j| z3c}}| dScc}}wcc} }wcc}}w)a$ If *prop* is *None*, return a list of reST-formatted strings of all settable properties and their valid values. If *prop* is not *None*, it is a valid property name and that property will be returned as a string of "property : valid" values. rrfNrrx.rrrc32K|]}t|ywr9r)rns r rz6ArtistInspector.pprint_setters_rest..us-!s1v-c32K|]}t|ywr9r)rrs r rz6ArtistInspector.pprint_setters_rest..vs/!s1v/rz =z .. table::z :class: property-tableProperty Description)rrr]r__mro__rrcr}rHrIrrrYljustzip)r=rdr r r prop_and_qualnamesrTrrr_col0_lencol1_lentable_formatstrrrs r pprint_setters_restz#ArtistInspector.pprint_setters_restQss  $CC  ++D1GU4&7), ,4++-. FDvv~~ 8 TFmT:fnn8 8 !4v7  % %&++,Af.A.A-BCD F F&89"T6''f5'+V4',/099 #56tQ((.66-u--/w//+h6>xO  ,  - -   %K***84 4 #))(3 4   eW-/!QEkAGGH--58II/        96 /s value.rignoreNr) rrrrrsortrwarningscatch_warnings simplefilter Exception)r=rrzgettersrrr>s r ruzArtistInspector.propertiess JJ$'FNDoof-(71d;K2LNN   "D1d#D}}T" ",,.!))(3&C! "$qr(  "!N!!  s//CCC 2C C C C#"C#c~g}t|jjD]\}}t|dddk7r t |dkDrt |dddz}n t |}|j dd}t |dkDr|dddz}|j|}|jd |d ||S) z8Return the getters and actual values as list of strings.shaperDNz... r2z z = ) rrur|rrrUrrr})r=r rzr>rfs r pprint_getterszArtistInspector.pprint_getterss 1 7 7 9: .ID#sGR(B.3s8a<BQL5(H $$A1v{crFUN$$T*D LL4vS, - . r")Nr)Nr)rGrHrIrcrrrcompilerrrr] staticmethodrrrrrrr r rur.rDr"r r\r\s )(0)bjjA%N & 7 7  +  + M 2"05 n* r"r\c|6t|}|j}tdj|yt |d|zS)a Return the value of an `.Artist`'s *property*, or print all of them. Parameters ---------- obj : `~matplotlib.artist.Artist` The queried artist; e.g., a `.Line2D`, a `.Text`, or an `~.axes.Axes`. property : str or None, default: None If *property* is 'somename', this function returns ``obj.get_somename()``. If it's None (or unset), it *prints* all gettable properties from *obj*. Many properties have aliases for shorter typing, e.g. 'lw' is an alias for 'linewidth'. In the output, aliases and full property names will be listed as: property or alias = value e.g.: linewidth or lw = 2 See Also -------- setp Nr,r)r\r.printrr)rrinsprs r getpr4sL8s#!!# diin *73) * ,,r"filec t|tr|g}nttj|}|syt |d}|s\t |dkrN|r!t|j|d|ytdj|j|yt |dzr tdtt|ddd|ddd}|Dcgc]}|j|c}|Dcgc]}|jd i|c}z}ttj|Scc}wcc}w) a& Set one or more properties on an `.Artist`, or list allowed values. Parameters ---------- obj : `~matplotlib.artist.Artist` or list of `.Artist` The artist(s) whose properties are being set or queried. When setting properties, all artists are affected; when querying the allowed values, only the first instance in the sequence is queried. For example, two lines can be made thicker and red with a single call: >>> x = arange(0, 1, 0.01) >>> lines = plot(x, sin(2*pi*x), x, sin(4*pi*x)) >>> setp(lines, linewidth=2, color='r') file : file-like, default: `sys.stdout` Where `setp` writes its output when asked to list allowed values. >>> with open('output.log') as file: ... setp(line, file=file) The default, ``None``, means `sys.stdout`. *args, **kwargs The properties to set. The following combinations are supported: - Set the linestyle of a line to be dashed: >>> line, = plot([1, 2, 3]) >>> setp(line, linestyle='--') - Set multiple properties at once: >>> setp(line, linewidth=2, color='r') - List allowed values for a line's linestyle: >>> setp(line, 'linestyle') linestyle: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} - List all properties that can be set, and their allowed values: >>> setp(line) agg_filter: a filter function, ... [long output listing omitted] `setp` also supports MATLAB style string/value pairs. For example, the following are equivalent: >>> setp(lines, 'linewidth', 2, 'color', 'r') # MATLAB style >>> setp(lines, linewidth=2, color='r') # Python style See Also -------- getp Nrr)rdr5r,z(The set args must be string, value pairsr rD)rrKrr flattenr\rr2r rrdictrrrO) rr6rrobjsr3funcvalsrrs r setpr<sv#vuEMM#&'  47 #D c$i!m  $%%47%3$ ?  $))D//12 > 4y1}CDDCSqS 41:./H'+ ,!188H  ,/NA/N NC  c" ## -/Ns D:>D?ct|}tjdr!dj|j dSddj|j dzS)a Inspect an `~matplotlib.artist.Artist` class (using `.ArtistInspector`) and return information about its settable properties and their current values. Parameters ---------- artist : `~matplotlib.artist.Artist` or an iterable of `Artist`\s Returns ------- str The settable properties of *artist*, as plain text if :rc:`docstring.hardcopy` is False and as a rst table (intended for use in Sphinx) if it is True. zdocstring.hardcopyr,r)r z Properties: )r\rrrr r )rais r rbrb(sb  B||01 IIb,,!,< =L dii(9(9q(9(IJ JLr"r9)4 collectionsrr functoolsrrrrrrloggingnumbersr r rrr$numpyr/ matplotlibrrfr r r r transformsrrrrrrr getLoggerrGrr&r3r7r?r@rBr`rKrr\r4rr<rbrSrDr"r rGs"**(  @@@w"*(V  Y & |7|7~' 2kk\ !-H Q$hL.**,r"