
    hmy             	       f   S r SSKrSSKrSSKrSSKJrJr  SSKrSSKr	SSK
rSSKJrJrJrJrJrJrJrJrJrJrJr  SSKJrJr  \R@                  " SS/S	S
/SS// SQSS/S/S.5       " S S\RB                  5      5       r" " S S\"5      r# " S S\#5      r$ " S S\#5      r% " S S\%5      r& " S S\#5      r' " S S\'5      r( " S  S!\'5      r) " S" S#\"5      r* " S$ S%\*5      r+ " S& S'\#5      r, " S( S)\"5      r- " S* S+\"5      r. " S, S-\"5      r/ " S. S/5      r0 " S0 S1\0\"5      r1 " S2 S3\0\%5      r2g)4ay  
Classes for the efficient drawing of large collections of objects that
share most properties, e.g., a large number of line segments or
polygons.

The classes are not meant to be as flexible as their single element
counterparts (e.g., you may not be able to select all line styles) but
they are meant to be fast for common use cases (e.g., a large set of solid
line segments).
    N)NumberReal   )_api_pathartistcbook	colorizercolors
_docstringhatchlinespath
transforms)	JoinStyleCapStyleantialiasedsaa
edgecolorsec
facecolorsfc)
linestylesdashesls
linewidthslwtransOffset)antialiased	edgecolor	facecolor	linestyle	linewidthoffset_transformc                     ^  \ rS rSrSr\R                  " S5      rSr\	R                  SSSSSSSSSSSSSSSSS	.U 4S
 jj5       rS rS rS rS rS rS rS;S jrS r\R*                  S 5       rS rS rS rS rS rS rS rS rS rS r S r!S r"S  r#S! r$\	R                  S" 5       r%\	R                  S# 5       r&\	R                  S$ 5       r'\	R                  S% 5       r(\)S& 5       r*S' r+S( r,S) r-S* r.S+ r/S, r0S- r1S. r2S/ r3S0 r4S1 r5S2 r6S3 r7\Rp                  Rr                  R                  \7l        S4 r:S5 r;S6 r<S7 r=S8 r>S9 r?S:r@U =rA$ )<
Collection   ai  
Base class for Collections. Must be subclassed to be usable.

A Collection represents a sequence of `.Patch`\es that can be drawn
more efficiently together than individually. For example, when a single
path is being drawn repeatedly at different offsets, the renderer can
typically execute a ``draw_marker()`` call much more efficiently than a
series of repeated calls to ``draw_path()`` with the offsets put in
one-by-one.

Most properties of a collection can be configured per-element. Therefore,
Collections have "plural" versions of many of the properties of a `.Patch`
(e.g. `.Collection.get_paths` instead of `.Patch.get_path`). Exceptions are
the *zorder*, *hatch*, *pickradius*, *capstyle* and *joinstyle* properties,
which can only be set globally for the whole collection.

Besides these exceptions, all properties can be specified as single values
(applying to all elements) or sequences of values. The property of the
``i``\th element of the collection is::

  prop[i % len(prop)]

Each Collection can optionally be used as its own `.ScalarMappable` by
passing the *norm* and *cmap* parameters to its constructor. If the
Collection's `.ScalarMappable` matrix ``_A`` has been set (via a call
to `.Collection.set_array`), then at draw time this internal scalar
mappable will be used to set the ``facecolors`` and ``edgecolors``,
ignoring those that were manually passed in.
r      r)   FNsolidg      @r   )r   r   r   r   capstyle	joinstyler   offsetsr$   normcmapr
   
pickradiusr   urlszorderc                  > [         TU ]  U R                  XU5      5        S/U l        S/U l        S/U l        S/U l        SU l        SU l        SU l	        SU l
        [        R                  " [        R                  S   5      U l        [        R                  S   U l        U R#                  U5        U R%                  U5        U R'                  U5        U R)                  U5        U R+                  U5        U R-                  U5        U R/                  U5        U R1                  U5        U R3                  U5        U(       a  U R5                  U5        OSU l        U(       a  U R9                  U5        OSU l        Ub4  [<        R>                  " U[@        5      nURB                  S:X  a	  USSS24   nXl"        Xl#        SU l$        U RK                  U5        SU l&        g)a  
Parameters
----------
edgecolors : :mpltype:`color` or list of colors, default: :rc:`patch.edgecolor`
    Edge color for each patch making up the collection. The special
    value 'face' can be passed to make the edgecolor match the
    facecolor.
facecolors : :mpltype:`color` or list of colors, default: :rc:`patch.facecolor`
    Face color for each patch making up the collection.
linewidths : float or list of floats, default: :rc:`patch.linewidth`
    Line width for each patch making up the collection.
linestyles : str or tuple or list thereof, default: 'solid'
    Valid strings are ['solid', 'dashed', 'dashdot', 'dotted', '-',
    '--', '-.', ':']. Dash tuples should be of the form::

        (offset, onoffseq),

    where *onoffseq* is an even length tuple of on and off ink lengths
    in points. For examples, see
    :doc:`/gallery/lines_bars_and_markers/linestyles`.
capstyle : `.CapStyle`-like, default: 'butt'
    Style to use for capping lines for all paths in the collection.
    Allowed values are %(CapStyle)s.
joinstyle : `.JoinStyle`-like, default: 'round'
    Style to use for joining lines for all paths in the collection.
    Allowed values are %(JoinStyle)s.
antialiaseds : bool or list of bool, default: :rc:`patch.antialiased`
    Whether each patch in the collection should be drawn with
    antialiasing.
offsets : (float, float) or list thereof, default: (0, 0)
    A vector by which to translate each patch after rendering (default
    is no translation). The translation is performed in screen (pixel)
    coordinates (i.e. after the Artist's transform is applied).
offset_transform : `~.Transform`, default: `.IdentityTransform`
    A single transform which will be applied to each *offsets* vector
    before it is used.
cmap, norm
    Data normalization and colormapping parameters. See
    `.ScalarMappable` for a detailed description.
hatch : str, optional
    Hatching pattern to use in filled paths, if any. Valid strings are
    ['/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*']. See
    :doc:`/gallery/shapes_and_collections/hatch_style_reference` for
    the meaning of each hatch type.
pickradius : float, default: 5.0
    If ``pickradius <= 0``, then `.Collection.contains` will return
    ``True`` whenever the test point is inside of one of the polygons
    formed by the control points of a Path in the Collection. On the
    other hand, if it is greater than 0, then we instead check if the
    test point is contained in a stroke of width ``2*pickradius``
    following any of the Paths in the Collection.
urls : list of str, default: None
    A URL for each patch to link to once drawn. Currently only works
    for the SVG backend. See :doc:`/gallery/misc/hyperlinks_sgskip` for
    examples.
zorder : float, default: 1
    The drawing order, shared by all Patches in the Collection. See
    :doc:`/gallery/misc/zorder_demo` for all defaults and examples.
**kwargs
    Remaining keyword arguments will be used to set properties as
    ``Collection.set_{key}(val)`` for each key-value pair in *kwargs*.
r   Nr   Nzhatch.colorzhatch.linewidth   )'super__init___get_colorizer_us_linestyles_linestyles_us_lw_linewidths	_gapcolor_face_is_mapped_edge_is_mapped_mapped_colorsmcolorsto_rgbamplrcParams_hatch_color_hatch_linewidthset_facecolorset_edgecolorset_linewidthset_linestyleset_antialiasedset_pickradiusset_urls	set_hatch
set_zorderset_capstyle	_capstyleset_joinstyle
_joinstylenp
asanyarrayfloatshape_offsets_offset_transform_path_effects_internal_update_paths)selfr   r   r   r   r+   r,   r   r-   r$   r.   r/   r
   r0   r   r1   r2   kwargs	__class__s                     H/var/www/html/env/lib/python3.13/site-packages/matplotlib/collections.pyr8   Collection.__init__N   s   f 	,,TCD  )k%;c3  $#"#OOCLL,GH #-> ?:&:&:&:&\*J'duh'!DNy)"DOmmGU3G}}$!$'*!1!f%    c                     U R                   $ Nr]   r^   s    ra   	get_pathsCollection.get_paths       {{rc   c                     Xl         SU l        g NTr]   stale)r^   pathss     ra   	set_pathsCollection.set_paths   s    
rc   c                     U R                   $ re   )_transformsrg   s    ra   get_transformsCollection.get_transforms       rc   c                 \   U R                   c&  [        R                  " 5       U l         U R                   $ [        U R                   [        R                  5      (       dE  [        U R                   S5      (       a*  U R                   R                  U R                  5      U l         U R                   $ )z<Return the `.Transform` instance used by this artist offset._as_mpl_transform)rZ   r   IdentityTransform
isinstance	Transformhasattrrx   axesrg   s    ra   get_offset_transformCollection.get_offset_transform   s    !!)%/%A%A%CD"
 %%%	 T33Z5I5IJJ$002EFF&&88C "%%%rc   c                     Xl         g)zY
Set the artist offset transform.

Parameters
----------
offset_transform : `.Transform`
N)rZ   )r^   r$   s     ra   set_offset_transformCollection.set_offset_transform   s
     "2rc   c                    U R                  5       nU R                  5       n[        U[        R                  5      (       d4  UR                  U5      (       d  [        R                  R                  5       $ U R                  5       n[        U5      (       d  [        R                  R                  5       $ UR                  (       d   U Vs/ s H  oRR                  U5      PM     nnU R                  5       n[        UR                  U5      5      (       a  [        U[        R                   R"                  5      (       a  UR%                  [        R&                  5      n[(        R*                  " UR-                  5       U-
  UU R/                  5       UR1                  U5      UR-                  5       R3                  5       5      $ U R4                  b  X1-
  R7                  U5      n[        R                   R9                  U5      nUR:                  R=                  5       (       d1  [        R                  R                  5       nUR?                  U5        U$ [        R                  R                  5       $ s  snf re   ) get_transformr~   rz   r   ry   contains_branchBboxnullrh   len	is_affinetransform_path_non_affineget_offsetsanycontains_branch_seperatelyrU   maMaskedArrayfillednanmpathget_path_collection_extents
get_affinert   transform_non_affinefrozenrY   	transformmasked_invalidmaskallupdate_from_data_xy)r^   	transDatar   
offset_trfro   pr-   bboxs           ra   get_datalimCollection.get_datalim   s   " &&(	..0
:z'C'CDD--i88 ??'')) 5zz??''))""EJKU88;UEK ""$y33I>??
 '255#4#455!..044$$&2E##%//8%%'..0	2 2 ==$ "-88AGee**73G<<##%%!++-((1##%%I Ls   I+c                 J    U R                  [        R                  " 5       5      $ re   )r   r   ry   )r^   renderers     ra   get_window_extentCollection.get_window_extent7  s     
 < < >??rc   c           	         U R                  5       nU R                  5       nU R                  5       nU R                  5       nU R	                  5       (       a  / nU R                  5        H  nUR
                  nUS S 2S4   US S 2S4   pU R                  U5      nU R                  U5      nUR                  [        R                  " [        R                  " Xx/5      UR                  5      5        M     U R                  US S 2S4   5      nU R                  US S 2S4   5      n[        R                  R                  Xx/5      nUR                  (       d1  U Vs/ s H  nUR!                  U5      PM     nnUR#                  5       nUR                  (       d!  UR%                  U5      nUR#                  5       n['        U[        R                  R(                  5      (       a  UR+                  [        R,                  5      nXX44$ s  snf )Nr   r   )r   r~   r   rh   
have_unitsverticesconvert_xunitsconvert_yunitsappendr   PathrU   column_stackcodesr   r   r   r   r   rz   r   r   r   )	r^   r   r   r-   ro   r   r   xsyss	            ra   _prepare_pointsCollection._prepare_points<  s    &&(	..0
""$ ??E(==!!Q$!Q$B((,((,UZZ(A4::NO ) $$WQT]3B$$WQT]3Bee(("2G""!&(!& 88>!&  (!,,.I## 55g>G#..0Jgruu0011nnRVV,G g44(s   Hc                    U R                  5       (       d  g UR                  U R                  R                  U R	                  5       5        U R                  5         U R                  5       u  p#pEUR                  5       nU R                  U5        UR                  U R                  5       5        U R                  (       aQ  UR                  U R                  5        UR                  U R                  5        UR                  U R                   5        U R#                  5       b  UR$                  " U R#                  5       6   U R'                  5       (       a  SSKJn  U" U R'                  5       U5      nU R-                  5       nU R/                  5       n	U R1                  5       n
Sn[3        U5      S:X  GaU  [3        U5      S::  GaE  [3        U	5      S:X  Ga5  [3        U
5      S:X  Ga%  [3        U R4                  5      S:X  Ga  [7        S U R8                   5       5      (       a  [3        U R:                  5      S:X  a  [3        U R<                  5      S:X  a  U R?                  5       c  [3        U5      (       a  [@        RB                  " US   5      U-   nOUnUS   RE                  U5      nURF                  U RI                  SS9RJ                  RF                  :  a3  URL                  U RI                  SS9RJ                  RL                  :  a  SnU RN                  (       a  URQ                  U RN                  5        U RR                  (       a  URU                  U RR                  5        U(       a  URW                  [Y        U
S   5      5        UR[                  U R4                  S   5        UR\                  " U R8                  S   6   UR_                  U R:                  S   5        URa                  U R<                  S   5        URc                  XeS   WRe                  5       [f        Rh                  " U5      U[Y        U	S   5      5        GOU Rj                  b  U Rm                  5       u  pURo                  XbRe                  5       UU R-                  5       XC[p        Rr                  " S5      /U Rj                  U R4                  UU R:                  U R<                  S	5        URo                  XbRe                  5       UU R-                  5       XCU R/                  5       U R1                  5       U R4                  U R8                  U R:                  U R<                  S	5        URu                  5         URw                  U R                  R                  5        SU l<        g )
Nr   )PathEffectRendererFr   c              3   .   #    U  H  oS    SL v   M     g7f)r   N ).0r   s     ra   	<genexpr>"Collection.draw.<locals>.<genexpr>  s     =,<bqETM,<   Trootnonescreen)=get_visible
open_groupr`   __name__get_gidupdate_scalarmappabler   new_gc_set_gc_clipset_snapget_snap_hatchrO   set_hatch_colorrF   set_hatch_linewidthrG   get_sketch_paramsset_sketch_paramsget_path_effectsmatplotlib.patheffectsr   rt   get_facecolorget_edgecolorr   r=   r   r;   _antialiaseds_urls	get_hatchr   Affine2Dget_extentswidth
get_figurer   heightrT   rS   rR   rQ   set_foregroundtuplerJ   
set_dashesrL   set_urldraw_markersr   r   r   r>   _get_inverse_paths_linestylesdraw_path_collectionrB   rC   restoreclose_grouprn   )r^   r   r   r   r-   ro   gcr   transr   r   do_single_path_optimizationcombined_transformextentsipathsilinestyless                   ra   drawCollection.draw`  s7   !!DNN33T\\^D""$040D0D0F-	w__"
DMMO$;;LL%t001""4#8#89!!#/  $"8"8":;  ""A)$*?*?*A8LH ##%'')
'')
&+#J!OE
aJ1$ZA)=D$$%*=D,<,<===D&&'1,TZZA1E (5zz%/%8%8q%BY%N"%."Ah**+=>GT : ? ? E EEd)C)H)H)O)OO.2+??T__->>OODNN+&eJqM23T--a01MM4++A./t11!45JJtzz!}%!!!H0779

7#Zz!}1EG ~~)&*&H&H&J#--((*F'')7__V,-t~~$$k&&

 ))$$&##%w""$d&8&8&:  $"2"2""DJJ 	

T^^445
rc   c                 X    [        U[        5      (       d  [        SU< 35      eXl        g)zw
Set the pick radius used for containment tests.

Parameters
----------
pickradius : float
    Pick radius, in points.
z-pickradius must be a real-valued number, not N)rz   r   
ValueError_pickradius)r^   r0   s     ra   rM   Collection.set_pickradius  s0     *d++?
~NP P%rc   c                     U R                   $ re   )r   rg   s    ra   get_pickradiusCollection.get_pickradius  rv   rc   c                 F   U R                  U5      (       d  U R                  5       (       d  S0 4$ [        U R                  [        5      (       a$  U R                  SLa  [        U R                  5      OU R                  nU R                  (       a  U R                  R                  5         U R                  5       u  p4pV[        R                  " UR                  UR                  UUR                  5       X`R                  5       XTUS:*  5	      n[!        U5      S:  [#        US94$ )z
Test whether the mouse event occurred in the collection.

Returns ``bool, dict(ind=itemlist)``, where every item in itemlist
contains the event.
FTr   )ind)_different_canvasr   rz   _pickerr   rW   r   r}   _unstale_viewLimr   r   point_in_path_collectionxyr   rt   r   dict)r^   
mouseeventr0   r   r   r-   ro   r   s           ra   containsCollection.contains  s     !!*--T5E5E5G5G"9 $,,//||4' $,, !!	 	
 99II&&(040D0D0F-	w ,,LL*,,
':':'<q2 3x!|Tc]**rc   c                 ,    Ub  UOS/U l         SU l        g)z
Parameters
----------
urls : list of str or None

Notes
-----
URLs are currently only implemented by the SVG backend. They are
ignored by all other backends.
NT)r   rn   )r^   r1   s     ra   rN   Collection.set_urls  s     "-TD6

rc   c                     U R                   $ )z
Return a list of URLs, one for each element of the collection.

The list contains *None* for elements without a URL. See
:doc:`/gallery/misc/hyperlinks_sgskip` for an example.
)r   rg   s    ra   get_urlsCollection.get_urls  s     zzrc   c                 J    [         R                  " U5        Xl        SU l        g)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.

Unlike other properties such as linewidth and colors, hatching
can only be specified for the collection as a whole, not separately
for each member.

Parameters
----------
hatch : {'/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
TN)mhatch_validate_hatch_patternr   rn   )r^   r   s     ra   rO   Collection.set_hatch  s    < 	&&u-
rc   c                     U R                   $ )z$Return the current hatching pattern.)r   rg   s    ra   r   Collection.get_hatch   s    {{rc   c                     Xl         g)zSet the hatch linewidth.NrG   r^   r   s     ra   r   Collection.set_hatch_linewidth$  s     "rc   c                     U R                   $ )zReturn the hatch linewidth.r
  rg   s    ra   get_hatch_linewidthCollection.get_hatch_linewidth(  s    $$$rc   c           
         [         R                  " U5      nUR                  S:X  a	  USSS24   n[        U[         R                  R
                  5      (       a  [         R                  R                  O[         R                  nU" [         R                  " U R                  USS2S4   5      [        5      [         R                  " U R                  USS2S4   5      [        5      45      U l
        SU l        g)z`
Set the offsets for the collection.

Parameters
----------
offsets : (N, 2) or (2,) array-like
r5   Nr   r   T)rU   rV   rX   rz   r   r   r   r   rW   r   rY   rn   )r^   r-   cstacks      ra   set_offsetsCollection.set_offsets,  s     --(==D dAg&G(27BEE<M<M(N(N"%%$$ 	]]4..wq!t}=uE]]4..wq!t}=uEGH 
rc   c                 `    U R                   c  [        R                  " S5      $ U R                   $ )z&Return the offsets for the collection.r   r6   )rY   rU   zerosrg   s    ra   r   Collection.get_offsets>  s%     $(==#8rxxKdmmKrc   c                 (    [         R                  S   $ )Nzpatch.linewidthrD   rE   rg   s    ra   _get_default_linewidth!Collection._get_default_linewidthC      ||-..rc   c                     Uc  U R                  5       n[        R                  " U5      U l        U R	                  U R                  U R
                  5      u  U l        U l        SU l        g)z
Set the linewidth(s) for the collection.  *lw* can be a scalar
or a sequence; if it is a sequence the patches will cycle
through the sequence

Parameters
----------
lw : float or list of floats
NT)	r  rU   
atleast_1dr<   _bcast_lwlsr:   r=   r;   rn   r  s     ra   rJ   Collection.set_linewidthG  sZ     :,,.BmmB' .2-=-=KK,,..*$*
rc   c                 j    [         R                  " U5      /nX l        U R	                  U R
                  U R                  5      u  U l        U l        g! [         aU     U Vs/ s H  n[         R                  " U5      PM     Os  snf nn Ns! [         a  nSU< S3n[        U5      UeSnAff = ff = f)a  
Set the linestyle(s) for the collection.

===========================   =================
linestyle                     description
===========================   =================
``'-'`` or ``'solid'``        solid line
``'--'`` or  ``'dashed'``     dashed line
``'-.'`` or  ``'dashdot'``    dash-dotted line
``':'`` or ``'dotted'``       dotted line
===========================   =================

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 : str or tuple or list thereof
    Valid values for individual linestyles include {'-', '--', '-.',
    ':', '', (offset, on-off-seq)}. See `.Line2D.set_linestyle` for a
    complete description.
zDo not know how to convert z
 to dashesN)mlines_get_dash_patternr   r:   r  r<   r=   r;   )r^   r   r   r   erremsgs         ra   rK   Collection.set_linestyle[  s    4	0..r23F % .2-=-=KK,,..*$*  	00?ABr!&2215rBB 04RF*E &C/0	0s5   A 
B2B" BB
B.B))B..B2c                 $    [        U5      U l        g)zx
Set the `.CapStyle` for the collection (for all its elements).

Parameters
----------
cs : `.CapStyle` or %(CapStyle)s
N)r   rR   )r^   css     ra   rQ   Collection.set_capstyle  s     ""rc   c                 T    U R                   (       a  U R                   R                  $ S$ )zg
Return the cap style for the collection (for all its elements).

Returns
-------
%(CapStyle)s or None
N)rR   namerg   s    ra   get_capstyleCollection.get_capstyle  s     '+nnt~~"">$>rc   c                 $    [        U5      U l        g)z{
Set the `.JoinStyle` for the collection (for all its elements).

Parameters
----------
js : `.JoinStyle` or %(JoinStyle)s
N)r   rT   )r^   jss     ra   rS   Collection.set_joinstyle  s     $B-rc   c                 T    U R                   (       a  U R                   R                  $ S$ )zi
Return the join style for the collection (for all its elements).

Returns
-------
%(JoinStyle)s or None
N)rT   r+  rg   s    ra   get_joinstyleCollection.get_joinstyle  s     (,t##@D@rc   c           
         [         R                  S   (       a  X4$ [        U5      [        U 5      :w  aL  [        U5      n[        U 5      n[        R                  " X#5      n[        U5      X4-  -  n[        U 5      X$-  -  n [        X5       VVVs/ s H  u  u  pVn[        R                  " XVU5      PM!     nnnnX4$ s  snnnf )aH  
Internal helper function to broadcast + scale ls/lw

In the collection drawing code, the linewidth and linestyle are cycled
through as circular buffers (via ``v[i % len(v)]``).  Thus, if we are
going to scale the dash pattern at set time (not draw time) we need to
do the broadcasting now and expand both lists to be the same length.

Parameters
----------
linewidths : list
    line widths of collection
dashes : list
    dash specification (offset, (dash pattern tuple))

Returns
-------
linewidths, dashes : list
    Will be the same length, dashes are scaled by paired linewidth
z_internal.classic_mode)	rD   rE   r   mathgcdlistzipr"  _scale_dashes)r   r   l_dashesl_lwr6  odr   s           ra   r  Collection._bcast_lwls  s    , <<01%%v;#j/)6{Hz?D((8*C&\T[1Fj)X_=J %($;=$;jfqb &&qR0$; 	 = !!=s   &B<c                     U R                   $ )zK
Get the antialiasing state for rendering.

Returns
-------
array of bools
)r   rg   s    ra   get_antialiasedCollection.get_antialiased  s     !!!rc   c                     Uc  U R                  5       n[        R                  " [        R                  " U[        5      5      U l        SU l        g)z]
Set the antialiasing state for rendering.

Parameters
----------
aa : bool or list of bools
NT)_get_default_antialiasedrU   r  asarrayboolr   rn   )r^   r   s     ra   rL   Collection.set_antialiased  s:     :..0B]]2::b$+?@
rc   c                 (    [         R                  S   $ )Nzpatch.antialiasedr  rg   s    ra   rC  #Collection._get_default_antialiased  s    ||/00rc   c                 H    U R                  U5        U R                  U5        g)z
Set both the edgecolor and the facecolor.

Parameters
----------
c : :mpltype:`color` or list of RGBA tuples

See Also
--------
Collection.set_facecolor, Collection.set_edgecolor
    For setting the edge or face color individually.
N)rH   rI   r^   cs     ra   	set_colorCollection.set_color  s      	11rc   c                 (    [         R                  S   $ )Nzpatch.facecolorr  rg   s    ra   _get_default_facecolor!Collection._get_default_facecolor  r  rc   c                     Uc  U R                  5       n[        R                  " XR                  5      U l        SU l        g rl   )rO  rB   to_rgba_array_alpha_facecolorsrn   rJ  s     ra   _set_facecolorCollection._set_facecolor  s3    9++-A"00KK@
rc   c                     [        U[        5      (       a$  UR                  5       S;   a  UR                  5       nXl        U R	                  U5        g)a.  
Set the facecolor(s) of the collection. *c* can be a color (all patches
have same color), or a sequence of colors; if it is a sequence the
patches will cycle through the sequence.

If *c* is 'none', the patch will not be filled.

Parameters
----------
c : :mpltype:`color` or list of :mpltype:`color`
r   faceN)rz   strlower_original_facecolorrU  rJ  s     ra   rH   Collection.set_facecolor  s>     a!'')/?"?	A#$ Arc   c                     U R                   $ re   )rT  rg   s    ra   r   Collection.get_facecolor  rv   rc   c                     [         R                  " U R                  S5      (       a  U R                  5       $ U R                  $ )NrY  )r	   
_str_equal_edgecolorsr   rg   s    ra   r   Collection.get_edgecolor!  s6    D,,f55%%''###rc   c                 (    [         R                  S   $ )Nzpatch.edgecolorr  rg   s    ra   _get_default_edgecolor!Collection._get_default_edgecolor'  r  rc   c                     SnUcd  [         R                  S   (       d7  U R                  (       d&  [        R                  " U R
                  S5      (       a  U R                  5       nOSnSn[        R                  " US5      (       a  SU l        SU l	        g [        R                  " XR                  5      U l        U(       a7  [        U R                  5      (       a  [        U R                  S   5      U l        SU l	        g )NTzpatch.force_edgecolorr   FrY  r   )rD   rE   _edge_defaultr	   ra  r\  re  _str_lower_equalrb  rn   rB   rR  rS  r   r   rF   )r^   rK  r   s      ra   _set_edgecolorCollection._set_edgecolor+  s    945))''(@(@&II//1"'!!!V,,%DDJ"00KK@s4#3#344 %d&6&6q&9 :D
rc   c                     [        U[        5      (       a$  UR                  5       S;   a  UR                  5       nXl        U R	                  U5        g)z
Set the edgecolor(s) of the collection.

Parameters
----------
c : :mpltype:`color` or list of :mpltype:`color` or 'face'
    The collection edgecolor(s).  If a sequence, the patches cycle
    through it.  If 'face', match the facecolor.
rX  N)rz   rZ  r[  _original_edgecolorrj  rJ  s     ra   rI   Collection.set_edgecolor>  s>     a!'')/?"?	A#$ Arc   c                     [         R                  R                  X5        U R                  U R                  5        U R                  U R                  5        g)a<  
Set the transparency of the collection.

Parameters
----------
alpha : float or array of float or None
    If not None, *alpha* values must be between 0 and 1, inclusive.
    If an array is provided, its length must match the number of
    elements in the collection.  Masked values and nans are not
    supported.
N)r   Artist_set_alpha_for_arrayrU  r\  rj  rm  )r^   alphas     ra   	set_alphaCollection.set_alphaP  s>     	**47D445D445rc   c                     U R                   $ re   )r=   rg   s    ra   get_linewidthCollection.get_linewidthb  rv   rc   c                     U R                   $ re   )r;   rg   s    ra   get_linestyleCollection.get_linestylee  rv   rc   c                    U R                   nU R                  nSU l         SU l        U R                  bo  [        R                  " U R
                  S5      (       d5  SU l        [        R                  " U R                  S5      (       a  SU l         OU R                  c  SU l         U R                  =(       d    U R                   nUSL =(       d0    USL =(       d%    U R                   U:g  =(       d    U R                  U:g  nU=(       d    U$ )a  
Determine whether edges and/or faces are color-mapped.

This is a helper for update_scalarmappable.
It sets Boolean flags '_edge_is_mapped' and '_face_is_mapped'.

Returns
-------
mapping_change : bool
    True if either flag is True, or if a flag has changed.
FNr   TrY  )r@   r?   _Ar	   ra  r\  rm  )r^   edge0face0mappedchangeds        ra   _set_mappable_flagsCollection._set_mappable_flagsh  s     $$$$$$77##D$<$<fEE'+$##D$<$<fEE+/D(++3+/D(%%=)=)=D= 4ETM 4**e34**e3 	   rc   c                    U R                  5       (       d  gU R                  Gb&  U R                  R                  S:  a   [        U [        5      (       d  [        S5      e[        R                  " U R                  5      (       a  U R                  R                  U R                  R                  :w  a:  [        SU R                  R                   SU R                  R                   S35      eU R                  R                  U R                  R                  5      U l        U R                  U R                  U R                  5      U l        U R                  (       a  U R                  U l        OU R!                  U R"                  5        U R$                  (       a  U R                  U l        OU R)                  U R*                  5        SU l        g)z
Update colors from the scalar mappable array, if any.

Assign colors to edges and faces based on the array and/or
colors that were directly set, as appropriate.
Nr   z&Collections can only map rank 1 arrayszData array shape, z) is incompatible with alpha array shape, z. This can occur with the deprecated behavior of the "flat" shading option, in which a row and/or column of the data array is dropped.T)r  r|  ndimrz   	_MeshDatar   rU   iterablerS  sizerX   reshaperC   rA   r?   rT  rU  r\  r@   rb  rj  rm  rn   rg   s    ra   r    Collection.update_scalarmappable  sI    ''))77ww||a
4(C(C !IJJ{{4;;'';;##tww||3$,TWW]]O <C;;,,- .,,- - #kk11$''--@"&,,tww"DD#22D 8 89#22D 8 89
rc   c                 N    [         R                  " U R                  S5      (       + $ )zReturn whether face is colored.r   )r	   ri  r\  rg   s    ra   get_fillCollection.get_fill  s    ))$*B*BFKKKrc   c                 p   [         R                  R                  X5        UR                  U l        UR                  U l        UR
                  U l        UR                  U l        UR                  U l        UR                  U l        UR                  U l	        UR                  U l
        UR                  U l        UR                  U l        UR                  U l        UR                  U l        UR                  U l        UR                   U l        UR"                  U l        UR$                  U l        SU l        g)z#Copy properties from other to self.TN)r   rp  update_fromr   rA   r@   rm  rb  r?   r\  rT  r=   r;   r:   r   r   r|  r.   r/   rn   )r^   others     ra   r  Collection.update_from  s     	!!$."00#22$44#(#<#<  ,,$44#(#<#<  ,, ,, ,,#22 ,,ll ((JJ	JJ	
rc   )r|  rS  r   rR   r@   rb  r?   rT  r>   r   rF   rG   rT   r;   r=   rA   rZ   rY   rm  r\  r[   r]   r   r   r:   r<   r/   r.   rn   re   )Br   
__module____qualname____firstlineno____doc__rU   emptyrs   rh  r   interpdr8   rh   rp   rt   r~   r   r   r   r   r   allow_rasterizationr   rM   r   r   rN   r  rO   r   r   r  r  r   r  rJ   rK   rQ   r,  rS   r2  staticmethodr  r@  rL   rC  rL  rO  rU  rH   r   r   re  rj  rI   rs  rp  rq  rv  ry  r  r   r  r  __static_attributes____classcell__r`   s   @ra   r&   r&      s   F ((9%K M   #""&!C CJ &2C&J@
"5H W  Wr& +8 D#%$L
/((.T & & ? ? ( ( A A #" #"J"1 /" $/&$6  ::BBI   !D$LL rc   r&   c                   ^   ^  \ rS rSrSrSrS rSS jr\R                  U 4S j5       r
SrU =r$ )	_CollectionWithSizesi  z9
Base class for collections that have an array of sizes.
      ?c                     U R                   $ )zv
Return the sizes ('areas') of the elements in the collection.

Returns
-------
array
    The 'area' of each element.
)_sizesrg   s    ra   	get_sizes_CollectionWithSizes.get_sizes  s     {{rc   c                    Uc7  [         R                  " / 5      U l        [         R                  " S5      U l        O[         R
                  " U5      U l        [         R                  " [        U R                  5      SS45      U l        [         R                  " U R                  5      U-  S-  U R                  -  nX0R                  SS2SS4'   X0R                  SS2SS4'   SU R                  SS2SS4'   S	U l
        g)
a  
Set the sizes of each member of the collection.

Parameters
----------
sizes : `numpy.ndarray` or None
    The size to set for each element of the collection.  The
    value is the 'area' of the element.
dpi : float, default: 72
    The dpi of the canvas.
Nr(   r)         R@r   r   r  r6   T)rU   arrayr  r  rs   rD  r  r   sqrt_factorrn   )r^   sizesdpiscales       ra   	set_sizes_CollectionWithSizes.set_sizes  s     =((2,DK!xx	2D**U+DK!xxT[[)91a(@ADGGDKK(3.5DE(-Q1W%(-Q1W%(+DQ1W%
rc   c                    > U R                  U R                  U R                  SS9R                  5        [        TU ]  U5        g NTr   )r  r  r   r  r7   r   r^   r   r`   s     ra   r   _CollectionWithSizes.draw  s2    t{{DOOO$>$B$BCXrc   )r  rs   rn   )r  )r   r  r  r  r  r  r  r  r   r  r   r  r  r  s   @ra   r  r    s3     G	0   rc   r  c                   J   ^  \ rS rSrSrSU 4S jjrS rSSSS 4S	 jrS
rU =r	$ )PathCollectioni  zG
A collection of `~.path.Path`\s, as created by e.g. `~.Axes.scatter`.
Nc                 x   > [         TU ]  " S0 UD6  U R                  U5        U R                  U5        SU l        g)aC  
Parameters
----------
paths : list of `.path.Path`
    The paths that will make up the `.Collection`.
sizes : array-like
    The factor by which to scale each drawn `~.path.Path`. One unit
    squared in the Path's data space is scaled to be ``sizes**2``
    points when rendered.
**kwargs
    Forwarded to `.Collection`.
TNr   )r7   r8   rp   r  rn   )r^   ro   r  r_   r`   s       ra   r8   PathCollection.__init__  s4     	"6"uu
rc   c                     U R                   $ re   rf   rg   s    ra   rh   PathCollection.get_paths  rj   rc   r   autoc                     U $ re   r   )r   s    ra   <lambda>PathCollection.<lambda>  s    rc   c           	      (	   / n/ nU R                  5       SLnUc  [        R                  R                  SSS9nO4[	        U[
        5      (       a  [        R                  R                  U5      nUR                  5         US:X  ah  U(       d  [        R                  " S5        Xg4$ [        R                  " U R                  5       5      n	UR                  S[        R                  S   5      n
OLUS	:X  a7  [        R                  " U R                  5       5      n	UR                  S
S5      nO[        SU S35      eU" U	5      nUR                   R#                  UR%                  5       UR'                  5       5        UR                   R)                  UR%                  5       UR'                  5       5        US:X  a  Sn[+        U	5      U::  a  SnUc  U	nU" U5      nGOUS:X  a  U R                  5       nOUS	:X  a  U R                  5       n[	        U[        R                  R,                  5      (       a  UnOi[        R.                  " U5      (       a   [        R                  R1                  U5      nO.[3        U5      n[        R                  R5                  X"S-
  / SQS9nUR7                  U" W5      R%                  5       U" U5      R'                  5       5      nX" U5      R%                  5       :  X" U5      R'                  5       :*  -  nUU   n[        R8                  " UR%                  5       UR'                  5       S5      nU" U5      n[        R:                  " U5      n[        R<                  " UUU   UU   5      nU R?                  5       S   U RA                  5       S.UEn[C        X5       H  u  nnUS:X  a!  U RE                  U RG                  U5      5      nO:US	:X  a4  [        RH                  " U5      n
[        RJ                  " U
S5      (       a  Mg  [L        RN                  " S/S/4SWW
U RQ                  5       S   S.UD6nURS                  U5        [U        US5      (       a  URW                  U5        U" U5      nURS                  U5        M     Xg4$ )ak
  
Create legend handles and labels for a PathCollection.

Each legend handle is a `.Line2D` representing the Path that was drawn,
and each label is a string that represents the Path.

This is useful for obtaining a legend for a `~.Axes.scatter` plot;
e.g.::

    scatter = plt.scatter([1, 2, 3],  [4, 5, 6],  c=[7, 2, 3], num=None)
    plt.legend(*scatter.legend_elements())

creates three legend elements, one for each color with the numerical
values passed to *c* as the labels.

Also see the :ref:`automatedlegendcreation` example.

Parameters
----------
prop : {"colors", "sizes"}, default: "colors"
    If "colors", the legend handles will show the different colors of
    the collection. If "sizes", the legend will show the different
    sizes. To set both, use *kwargs* to directly edit the `.Line2D`
    properties.
num : int, None, "auto" (default), array-like, or `~.ticker.Locator`
    Target number of elements to create.
    If None, use all unique elements of the mappable array. If an
    integer, target to use *num* elements in the normed range.
    If *"auto"*, try to determine which option better suits the nature
    of the data.
    The number of created elements may slightly deviate from *num* due
    to a `~.ticker.Locator` being used to find useful locations.
    If a list or array, use exactly those elements for the legend.
    Finally, a `~.ticker.Locator` can be provided.
fmt : str, `~matplotlib.ticker.Formatter`, or None (default)
    The format or formatter to use for the labels. If a string must be
    a valid input for a `.StrMethodFormatter`. If None (the default),
    use a `.ScalarFormatter`.
func : function, default: ``lambda x: x``
    Function to calculate the labels.  Often the size (or color)
    argument to `~.Axes.scatter` will have been pre-processed by the
    user using a function ``s = f(x)`` to make the markers visible;
    e.g. ``size = np.log10(x)``.  Providing the inverse of this
    function here allows that pre-processing to be inverted, so that
    the legend labels have the correct values; e.g. ``func = lambda
    x: 10**x``.
**kwargs
    Allowed keyword arguments are *color* and *size*. E.g. it may be
    useful to set the color of the markers if *prop="sizes"* is used;
    similarly to set the size of the markers if *prop="colors"* is
    used. Any further parameters are passed onto the `.Line2D`
    instance. This may be useful to e.g. specify a different
    *markeredgecolor* or *alpha* for the legend handles.

Returns
-------
handles : list of `.Line2D`
    Visual representation of each element of the legend.
labels : list of str
    The string labels for elements of the legend.
NFT)	useOffsetuseMathTextr   zfCollection without array used. Make sure to specify the values to be colormapped via the `c` argument.r  zlines.markersizer  colorkz?Valid values for `prop` are 'colors' or 'sizes'. You supplied 'z
' instead.r  	   r   )r   r6   g      @r)            
   )nbinsmin_n_tickssteps   r   )markeredgewidthrr  g         )r   r  msmarkerset_locs),	get_arrayrD   tickerScalarFormatterrz   rZ  StrMethodFormattercreate_dummy_axiswarningswarnrU   uniquepoprE   r  r   axisset_view_intervalminmaxset_data_intervalr   Locatorr  FixedLocatorintMaxNLocatortick_valueslinspaceargsortinterpget_linewidths	get_alphar8  r/   r.   r  iscloser"  Line2Drh   r   r|   r  )r^   propnumfmtfuncr_   handleslabelshasarrayur  r  fuvalueslabel_valuesarrloccondyarrxarrixkwvallabhls                             ra   legend_elementsPathCollection.legend_elements  s   ~ >>#4/;**,,u$,OCS!!**//4C8 . / &		$..*+A::fcll3E&FGDW_		$..*+AJJw,E 77;fJH I I !W""2668RVVX6""2668RVVX6&=C1v};F<Lxnn&nn&#szz1122S!!jj--c2#hjj,,3E3N - P??49==?DIMMOLL!T#Y]]_4!T#Y]]_46D'-L;;swwy#'')S9D:DD!BYY|T"XtBx@F!%!4!4!6q!9~~' F1HCx		$))C.1wws|::dC((qcA3 @2Ut%)^^%5a%8@<>@ANN1sJ''\*CAMM! 2 rc   )rn   re   )
r   r  r  r  r  r8   rh   r  r  r  r  s   @ra   r  r    s*    & $, {J Jrc   r  c                   H   ^  \ rS rSrSSS.U 4S jjjrS	S jr\rS rSrU =r	$ )
PolyCollectioni  T)closedc                x   > [         TU ]  " S0 UD6  U R                  U5        U R                  X5        SU l        g)a  
Parameters
----------
verts : list of array-like
    The sequence of polygons [*verts0*, *verts1*, ...] where each
    element *verts_i* defines the vertices of polygon *i* as a 2D
    array-like of shape (M, 2).
sizes : array-like, default: None
    Squared scaling factors for the polygons. The coordinates of each
    polygon *verts_i* are multiplied by the square-root of the
    corresponding entry in *sizes* (i.e., *sizes* specify the scaling
    of areas). The scaling is applied before the Artist master
    transform.
closed : bool, default: True
    Whether the polygon should be closed by adding a CLOSEPOLY
    connection at the end.
**kwargs
    Forwarded to `.Collection`.
TNr   )r7   r8   r  	set_vertsrn   )r^   vertsr  r  r_   r`   s        ra   r8   PolyCollection.__init__  s4    ( 	"6"uu%
rc   c                    SU l         [        U[        R                  R                  5      (       a2  UR                  [        5      R                  [        R                  5      nU(       d-  U Vs/ s H  n[        R                  " U5      PM     snU l        g[        U[        R                  5      (       a  [        UR                  5      S:X  a  [        R                  " XSS2SS24   4SS9n[        R                   " UR                  S   [        R                  R"                  S9n[        R                  R$                  USS& [        R                  R&                  US'   [        R                  R(                  US'   U Vs/ s H  n[        R                  " X55      PM     snU l        g/ U l        U H|  n[        U5      (       a:  U R                  R+                  [        R                  R-                  U5      5        MM  U R                  R+                  [        R                  " U5      5        M~     gs  snf s  snf )	ap  
Set the vertices of the polygons.

Parameters
----------
verts : list of array-like
    The sequence of polygons [*verts0*, *verts1*, ...] where each
    element *verts_i* defines the vertices of polygon *i* as a 2D
    array-like of shape (M, 2).
closed : bool, default: True
    Whether the polygon should be closed by adding a CLOSEPOLY
    connection at the end.
TNr)   r   r  dtyper   )rn   rz   rU   r   r   astyperW   r   r   r   r   r]   ndarrayr   rX   concatenater  	code_typeLINETOMOVETO	CLOSEPOLYr   _create_closed)r^   r  r  xy	verts_padr   s         ra   r  PolyCollection.set_verts  s    
eRUU..//LL'..rvv6E 49:Eb5::b>E:DK eRZZ((S-=-BQU|'<1EI HHY__Q/uzz7K7KLEzz((E!Hzz((E!H

,,E"I;DE9R5::b09EDKB2ww""5::#<#<R#@A""5::b>2	 ! ; Fs   . H6 H;c                 "   [        U5      [        U5      :w  a  [        S5      e[        X5       VVs/ s HA  u  p4[        U5      (       a  [        R                  " X45      O[        R                  " U5      PMC     snnU l        SU l        gs  snnf )z$Initialize vertices with path codes.zB'codes' must be a 1D list or array with the same length of 'verts'TN)r   r   r8  r   r   r]   rn   )r^   r  r   r  cdss        ra   set_verts_and_codes"PolyCollection.set_verts_and_codes  sx    u:U# ? @ @ '*%&79&772 /2"gguzz"*5::b>I&79
9s   ABrm   re   )T)
r   r  r  r  r8   r  rp   r  r  r  r  s   @ra   r  r    s+    D  2(3T I rc   r  c                      ^  \ rS rSrSrSSSS.U 4S jjr\S 5       r\S 5       r	SS	.S
 jr
S rS rS r\S 5       rS r\S 5       r\S 5       rS rSrU =r$ )FillBetweenPolyCollectioni  zC
`.PolyCollection` that fills the area between two x- or y-curves.
NF)whereinterpolatestepc                p   > Xl         X`l        Xpl        U R                  X#XE5      n	[        T
U ]  " U	40 UD6  g)a  
Parameters
----------
t_direction : {{'x', 'y'}}
    The axes on which the variable lies.

    - 'x': the curves are ``(t, f1)`` and ``(t, f2)``.
    - 'y': the curves are ``(f1, t)`` and ``(f2, t)``.

t : array-like
    The ``t_direction`` coordinates of the nodes defining the curves.

f1 : array-like or float
    The other coordinates of the nodes defining the first curve.

f2 : array-like or float
    The other coordinates of the nodes defining the second curve.

where : array-like of bool, optional
    Define *where* to exclude some {dir} regions from being filled.
    The filled regions are defined by the coordinates ``t[where]``.
    More precisely, fill between ``t[i]`` and ``t[i+1]`` if
    ``where[i] and where[i+1]``.  Note that this definition implies
    that an isolated *True* value between two *False* values in *where*
    will not result in filling.  Both sides of the *True* position
    remain unfilled due to the adjacent *False* values.

interpolate : bool, default: False
    This option is only relevant if *where* is used and the two curves
    are crossing each other.

    Semantically, *where* is often used for *f1* > *f2* or
    similar.  By default, the nodes of the polygon defining the filled
    region will only be placed at the positions in the *t* array.
    Such a polygon cannot describe the above semantics close to the
    intersection.  The t-sections containing the intersection are
    simply clipped.

    Setting *interpolate* to *True* will calculate the actual
    intersection point and extend the filled region up to this point.

step : {{'pre', 'post', 'mid'}}, optional
    Define *step* if the filling should be a step function,
    i.e. constant in between *t*.  The value determines where the
    step will occur:

    - 'pre': The f value is continued constantly to the left from
      every *t* position, i.e. the interval ``(t[i-1], t[i]]`` has the
      value ``f[i]``.
    - 'post': The y value is continued constantly to the right from
      every *x* position, i.e. the interval ``[t[i], t[i+1])`` has the
      value ``f[i]``.
    - 'mid': Steps occur half-way between the *t* positions.

**kwargs
    Forwarded to `.PolyCollection`.

See Also
--------
.Axes.fill_between, .Axes.fill_betweenx
N)t_direction_interpolate_step_make_vertsr7   r8   )r^   r!  tf1f2r  r  r  r_   r  r`   s             ra   r8   "FillBetweenPolyCollection.__init__  s;    @ ''
  2)&)rc   c                 @    U S:X  a  gU S:X  a  gSU < 3n[        U5      e)z/The direction that is other than `t_direction`.r   r   z$t_direction must be 'x' or 'y', got )r   )r!  msgs     ra   _f_dir_from_t'FillBetweenPolyCollection._f_dir_from_t?  s0     #C8HCS/!rc   c                 8    U R                  U R                  5      $ )z4The direction that is other than `self.t_direction`.)r+  r!  rg   s    ra   _f_direction&FillBetweenPolyCollection._f_directionJ  s     !!$"2"233rc   )r  c                    U R                   R                  U R                  U R                  XU5      u  pnU R	                  XX45      nU R                  U5        g)a  
Set new values for the two bounding curves.

Parameters
----------
t : array-like
    The ``self.t_direction`` coordinates of the nodes defining the curves.

f1 : array-like or float
    The other coordinates of the nodes defining the first curve.

f2 : array-like or float
    The other coordinates of the nodes defining the second curve.

where : array-like of bool, optional
    Define *where* to exclude some {dir} regions from being filled.
    The filled regions are defined by the coordinates ``t[where]``.
    More precisely, fill between ``t[i]`` and ``t[i+1]`` if
    ``where[i] and where[i+1]``.  Note that this definition implies
    that an isolated *True* value between two *False* values in *where*
    will not result in filling.  Both sides of the *True* position
    remain unfilled due to the adjacent *False* values.

See Also
--------
.PolyCollection.set_verts, .Line2D.set_data
N)r}   _fill_between_process_unitsr!  r.  r$  r  )r^   r%  r&  r'  r  r  s         ra   set_data"FillBetweenPolyCollection.set_dataO  sQ    8 II99d//<	r   2urc   c                    [         R                  R                  5       nUR                  U R	                  5       U-
  R                  [        R                  " U R                  U R                  R                  //5      5      5        U$ )z7Calculate the data limits and return them as a `.Bbox`.)
r   r   r   r   r   r   rU   r  _bboxminpos)r^   r   datalims      ra   r   %FillBetweenPolyCollection.get_datalimq  se    //&&(##T%7%7%9I%E$P$PNNDJJ):):(;<=%? 	@rc   c                 v   U R                  U R                  U R                  XU5        U R                  XX45      n[        R
                  " [        R                  " U5      X#SS9u  pn[        R                  R                  5       U l
        U R                  R                  U R                  [        R                  " X#4 Vs/ s H  n[        R                  " X   XT   4SS9PM      sn5      5      5        [        R                   " U5       VVs/ s H  u  pgU R#                  XX6U5      PM     snn$ s  snf s  snnf )z8
Make verts that can be forwarded to `.PolyCollection`.
T)subokr  r  )_validate_shapesr!  r.  _get_data_maskrU   broadcast_arraysr  r   r   r   r5  r   _fix_pts_xy_orderr  stackr	   contiguous_regions_make_verts_for_region)r^   r%  r&  r'  r  fidx0idx1s           ra   r$  %FillBetweenPolyCollection._make_vertsx  s    	d..0A0A1"M##A25''a(8"M	r__))+


&&t'='=bnn>@XNG=EBHHah)3XNG ?H (I 	J
 $66u=
=
 ''r>=
 	
NG
s    %D0D5c           
         Uc  SnOo[         R                  " U[        S9nUR                  UR                  :w  a<  SR	                  UR                  U R
                  UR                  5      n[        U5      eU[        R                  " [         R                  [        [         R                  R                  XU/5      5      ) -  $ )z
Return a bool array, with True at all points that should eventually be rendered.

The array is True at a point if none of the data inputs
*t*, *f1*, *f2* is masked and if the input *where* is true at that point.
Tr	  z-where size ({}) does not match {!r} size ({}))rU   rD  rE  r  formatr!  r   	functoolsreduce
logical_ormapr   getmaskarray)r^   r%  r&  r'  r  r*  s         ra   r<  (FillBetweenPolyCollection._get_data_mask  s     =EJJuD1EzzQVV#ELLJJ 0 0!&&: o%	((MM3ruu11A2;?A A A 	Arc   c                 v   S [        XU4S5       5       n[        XRX4/5       H  u  pgUR                  S:  a  [        U< S35      eUR                  S:  d  M6  UR                  S:  d  MH  UR                  UR                  :w  d  Md  SR	                  XR                  XgR                  5      n[        U5      e   g)zFValidate that t, f1 and f2 are 1-dimensional and have the same length.c              3   .   #    U  H  u  pX-   v   M     g 7fre   r   )r   r=  ss      ra   r   =FillBetweenPolyCollection._validate_shapes.<locals>.<genexpr>  s     N#M41#Mr   )r  12r   z is not 1-dimensionalz4{!r} has size {}, but {!r} has an unequal size of {}N)r8  r  r   r  rG  )	t_dirf_dirr%  r&  r'  namesr+  r  r*  s	            ra   r;  *FillBetweenPolyCollection._validate_shapes  s     O3e'<n#MNu"k2KDzzA~ D8+@!ABBvvzejj1n5::1ELSS6645 o% 3rc   c           
      &   XU nX$U nX4U nU R                   b,  [        R                  SU R                   -      n	U	" XgU5      u  pgnU R                  (       a%  U R	                  XX45      n
U R	                  XX55      nOUS   US   4n
US   US   4n[
        R                  " [
        R                  " U
/5      [
        R                  " Xg4SS9[
        R                  " U/5      [
        R                  " Xh4SS9SSS2   45      nU R                  U5      $ )zy
Make ``verts`` for a contiguous region between ``idx0`` and ``idx1``, taking
into account ``step`` and ``interpolate``.
Nzsteps-r   r  r  )
r#  r	   STEP_LOOKUP_MAPr"  _get_interpolating_pointsrU   r  rD  r?  r>  )r^   r%  r&  r'  rC  rD  t_slicef1_slicef2_slice	step_funcstartendptss                ra   rA  0FillBetweenPolyCollection._make_verts_for_region  s   
 ,4=4=::!--h.CDI*3Gx*P'Gx221"CE00AC AJ+E"+x|+CnnJJwHHg(r2JJuHHg(r24R48	: ; %%c**rc   c                    [        US-
  S5      nXUS-    nX%US-    X5US-    -
  nX%US-    n[        U5      S:X  a^  [        R                  R	                  US   5      (       a  X   X%   4$ [        R                  R	                  US   5      (       a  X   X$   4$ U R                  SXv5      n	U R                  XU5      n
X4$ )zCalculate interpolating points.r   r   r6   )r  r   rU   r   	is_masked_get_diff_root)clsr%  r&  r'  idxim1t_valuesdiff_values	f1_valuesdiff_root_tdiff_root_fs              ra   rZ  3FillBetweenPolyCollection._get_interpolating_points  s     #'1oQ<SUmbSUm33q5M	{q uu{1~..vrw&Q00vrw&((KB((	J''rc   c                 Z    UR                  5       n[        R                  " XU   X#   5      $ )zCalculate diff root.)r  rU   r  )r   xpfporders       ra   re  (FillBetweenPolyCollection._get_diff_root  s&     

yyuIry11rc   c                 >    U R                   S:X  a  USS2SSS24   $ U$ )z
Fix pts calculation results with `self.t_direction`.

In the workflow, it is assumed that `self.t_direction` is 'x'. If this
is not true, we need to exchange the coordinates.
r   Nr  )r!  )r^   ra  s     ra   r>  +FillBetweenPolyCollection._fix_pts_xy_order  s(      $//36s1dd7|?C?rc   )r5  r"  r#  r!  )r   r  r  r  r  r8   r  r+  propertyr.  r2  r   r$  r<  r;  rA  classmethodrZ  re  r>  r  r  r  s   @ra   r  r    s    
 ED* D*L " " 4 4 ,0  D
$A$ 	& 	&+: ( (" 2 2
@ @rc   r  c                      ^  \ rS rSrSr\R                  R                  r\	R                  S-  rSSS.U 4S jjrS rS	 r\R                   S
 5       rSrU =r$ )RegularPolyCollectioni  z)A collection of n-sided regular polygons.      r   )r   )rotationr  c                   > [         TU ]  " S0 UD6  U R                  U5        Xl        U R	                  U5      /U l        X l        U R                  [        R                  " 5       5        g)a  
Parameters
----------
numsides : int
    The number of sides of the polygon.
rotation : float
    The rotation of the polygon in radians.
sizes : tuple of float
    The area of the circle circumscribing the polygon in points^2.
**kwargs
    Forwarded to `.Collection`.

Examples
--------
See :doc:`/gallery/event_handling/lasso_demo` for a complete example::

    offsets = np.random.rand(20, 2)
    facecolors = [cm.jet(x) for x in np.random.rand(20)]

    collection = RegularPolyCollection(
        numsides=5, # a pentagon
        rotation=0, sizes=(50,),
        facecolors=facecolors,
        edgecolors=("black",),
        linewidths=(1,),
        offsets=offsets,
        offset_transform=ax.transData,
        )
Nr   )
r7   r8   r  	_numsides_path_generatorr]   	_rotationset_transformr   ry   )r^   numsidesr{  r  r_   r`   s        ra   r8   RegularPolyCollection.__init__  sX    F 	"6"u!++H56!:779:rc   c                     U R                   $ re   )r}  rg   s    ra   get_numsides"RegularPolyCollection.get_numsides      ~~rc   c                     U R                   $ re   )r  rg   s    ra   get_rotation"RegularPolyCollection.get_rotation  r  rc   c                 Z   U R                  U R                  U R                  SS9R                  5        U R                   Vs/ s HA  n[
        R                  " U5      R                  U R                  * 5      R                  5       PMC     snU l        [        R                  X5        g s  snf r  )r  r  r   r  rs   r   r   rotater  
get_matrixr&   r   )r^   r   r   s      ra   r   RegularPolyCollection.draw  s    t{{DOOO$>$B$BC %%
% "))4>>/:EEG%
 	'
s   AB()r}  r]   r  rs   )r   r  r  r  r  r   r   unit_regular_polygonr~  rU   pir  r8   r  r  r   r  r   r  r  r  s   @ra   ry  ry    sY    3jj55OeeoG
 	(; (;T (  (rc   ry  c                   D    \ rS rSrSr\R                  R                  rSr	g)StarPolygonCollectioni)  z:Draw a collection of regular stars with *numsides* points.r   N)
r   r  r  r  r  r   r   unit_regular_starr~  r  r   rc   ra   r  r  )  s    Djj22Orc   r  c                   D    \ rS rSrSr\R                  R                  rSr	g)AsteriskPolygonCollectioni.  z>Draw a collection of regular asterisks with *numsides* points.r   N)
r   r  r  r  r  r   r   unit_regular_asteriskr~  r  r   rc   ra   r  r  .  s    Hjj66Orc   r  c                      ^  \ rS rSrSrSrSS.U 4S jjrS r\r\r	S r
S	 rS
 rS rS rU 4S jrS r\rS r\rS rS rS rS rSrU =r$ )LineCollectioni3  a}  
Represents a sequence of `.Line2D`\s that should be drawn together.

This class extends `.Collection` to represent a sequence of
`.Line2D`\s instead of just a sequence of `.Patch`\s.
Just as in `.Collection`, each property of a *LineCollection* may be either
a single value or a list of values. This list is then used cyclically for
each element of the LineCollection, so the property of the ``i``\th element
of the collection is::

  prop[i % len(prop)]

The properties of each member of a *LineCollection* default to their values
in :rc:`lines.*` instead of :rc:`patch.*`, and the property *colors* is
added in place of *edgecolors*.
Tr6   )r2   c                p   > UR                  SS5        [        TU ]  " SSU0UD6  U R                  U5        g)a  
Parameters
----------
segments : list of (N, 2) array-like
    A sequence ``[line0, line1, ...]`` where each line is a (N, 2)-shape
    array-like containing points::

        line0 = [(x0, y0), (x1, y1), ...]

    Each line can contain a different number of points.
linewidths : float or list of float, default: :rc:`lines.linewidth`
    The width of each line in points.
colors : :mpltype:`color` or list of color, default: :rc:`lines.color`
    A sequence of RGBA tuples (e.g., arbitrary color strings, etc, not
    allowed).
antialiaseds : bool or list of bool, default: :rc:`lines.antialiased`
    Whether to use antialiasing for each line.
zorder : float, default: 2
    zorder of the lines once drawn.

facecolors : :mpltype:`color` or list of :mpltype:`color`, default: 'none'
    When setting *facecolors*, each line is interpreted as a boundary
    for an area, implicitly closing the path from the last point to the
    first point. The enclosed area is filled with *facecolor*.
    In order to manually specify what should count as the "interior" of
    each line, please use `.PathCollection` instead, where the
    "interior" can be specified by appropriate usage of
    `~.path.Path.CLOSEPOLY`.

**kwargs
    Forwarded to `.Collection`.
r   r   r2   Nr   )
setdefaultr7   r8   set_segments)r^   segmentsr2   r_   r`   s       ra   r8   LineCollection.__init__G  sC    L 	,/ 			 	(#rc   c           	      ,   Uc  g U Vs/ s Hq  n[        U[        R                  R                  5      (       a  [        R
                  " U5      O.[        R
                  " [        R                  " U[        5      5      PMs     snU l        SU l	        g s  snf rl   )
rz   rU   r   r   r   r   rD  rW   r]   rn   )r^   r  segs      ra   r  LineCollection.set_segmentss  st     #+,"*3 +5S"%%:K:K*L*Luzz#!JJrzz#u'=>?"*, 
,s   A8Bc                     / nU R                    HM  nUR                  SS9 VVs/ s H  u  p4UPM	     nnn[        R                  " U5      nUR	                  U5        MO     U$ s  snnf )zt
Returns
-------
list
    List of segments in the LineCollection. Each list item contains an
    array of vertices.
F)simplify)r]   iter_segmentsrU   rD  r   )r^   r  r   vertex_r   s         ra   get_segmentsLineCollection.get_segments  sx     KKD %%u%5 6	 F 
 6   zz(+HOOH%   s   A"c                 (    [         R                  S   $ )Nzlines.linewidthr  rg   s    ra   r  %LineCollection._get_default_linewidth  s    ||-..rc   c                 (    [         R                  S   $ )Nzlines.antialiasedr  rg   s    ra   rC  'LineCollection._get_default_antialiased  s    ||/00rc   c                 (    [         R                  S   $ )Nzlines.colorr  rg   s    ra   re  %LineCollection._get_default_edgecolor  s    ||M**rc   c                     g)Nr   r   rg   s    ra   rO  %LineCollection._get_default_facecolor  s    rc   c                 v   > [         TU ]  U5        U R                  b  U R                  U R                  5        g g re   )r7   rs  r>   set_gapcolor_original_gapcolor)r^   rr  r`   s     ra   rs  LineCollection.set_alpha  s3    % >>%d556 &rc   c                 &    U R                  U5        g)a  
Set the edgecolor(s) of the LineCollection.

Parameters
----------
c : :mpltype:`color` or list of :mpltype:`color`
    Single color (all lines have same color), or a
    sequence of RGBA tuples; if it is a sequence the lines will
    cycle through the sequence.
N)rI   rJ  s     ra   rL  LineCollection.set_color  s     	1rc   c                     U R                   $ re   )rb  rg   s    ra   	get_colorLineCollection.get_color  rv   rc   c                 2    Xl         U R                  U5        g)a  
Set a color to fill the gaps in the dashed line style.

.. note::

    Striped lines are created by drawing two interleaved dashed lines.
    There can be overlaps between those two, which may result in
    artifacts when using transparency.

    This functionality is experimental and may change.

Parameters
----------
gapcolor : :mpltype:`color` or list of :mpltype:`color` or None
    The color with which to fill the gaps. If None, the gaps are
    unfilled.
N)r  _set_gapcolorr^   gapcolors     ra   r  LineCollection.set_gapcolor  s    $ #+8$rc   c                 d    Ub   [         R                  " XR                  5      nXl        SU l        g rl   )rB   rR  rS  r>   rn   r  s     ra   r  LineCollection._set_gapcolor  s(    ,,X{{CH!
rc   c                     U R                   $ re   )r>   rg   s    ra   get_gapcolorLineCollection.get_gapcolor  r  rc   c           
      V   [        U R                  [        R                  " U R                  5      5       VVs/ s H[  u  pUS:X  a;  [
        R                  " [        R                  " S[        R                  5      5      U4OU[        R                  " U6 4PM]     nnn[        U6 $ s  snnf )z
Returns the path and pattern for the gaps in the non-solid lines.

This path and pattern is the inverse of the path and pattern used to
construct the non-solid lines. For solid lines, we set the inverse path
to nans to prevent drawing an inverse line.
r4   r  )r8  r]   	itertoolscycler;   r   r   rU   fullr   r"  _get_inverse_dash_pattern)r^   r   r   path_patternss       ra   r   ,LineCollection._get_inverse_paths_linestyles  s     Y__T-=-=>?A
 @  Y ZZ/0"5633R89: @ 	 A M""As   A"B%)r>   r  r]   rn   )r   r  r  r  r  rh  r8   r  r  rp   r  r  rC  re  rO  rs  rL  
set_colorsr  
get_colorsr  r  r  r   r  r  r  s   @ra   r  r  3  s    " M *$ *$X II0/1+7 J  J%*# #rc   r  c                      ^  \ rS rSrSrSr SSSSSSSS.U 4S	 jjjrS
 rS rS r	\	=r
rS rS rS rS rS rS rS rS rU 4S jrU 4S jrS rSrU =r$ )EventCollectioni  z
A collection of locations along a single axis at which an "event" occurred.

The events are given by a 1-dimensional array. They do not have an
amplitude and are displayed as parallel lines.
Tr   r   Nr*   )
lineoffset
linelengthr#   r  r"   r   c                   > [         T
U ]  " / 4XWXhS.U	D6  SU l        X@l        X0l        U R                  U5        U R                  U5        g)aY  
Parameters
----------
positions : 1D array-like
    Each value is an event.
orientation : {'horizontal', 'vertical'}, default: 'horizontal'
    The sequence of events is plotted along this direction.
    The marker lines of the single events are along the orthogonal
    direction.
lineoffset : float, default: 0
    The offset of the center of the markers from the origin, in the
    direction orthogonal to *orientation*.
linelength : float, default: 1
    The total height of the marker (i.e. the marker stretches from
    ``lineoffset - linelength/2`` to ``lineoffset + linelength/2``).
linewidth : float or list thereof, default: :rc:`lines.linewidth`
    The line width of the event lines, in points.
color : :mpltype:`color` or list of :mpltype:`color`, default: :rc:`lines.color`
    The color of the event lines.
linestyle : str or tuple or list thereof, default: 'solid'
    Valid strings are ['solid', 'dashed', 'dashdot', 'dotted',
    '-', '--', '-.', ':']. Dash tuples should be of the form::

        (offset, onoffseq),

    where *onoffseq* is an even length tuple of on and off ink
    in points.
antialiased : bool or list thereof, default: :rc:`lines.antialiased`
    Whether to use antialiasing for drawing the lines.
**kwargs
    Forwarded to `.LineCollection`.

Examples
--------
.. plot:: gallery/lines_bars_and_markers/eventcollection_demo.py
)r   r   r   r   TN)r7   r8   _is_horizontal_linelength_lineoffsetset_orientationset_positions)r^   	positionsorientationr  r  r#   r  r"   r   r_   r`   s             ra   r8   EventCollection.__init__  s\    ` 	 	#$- %	# "	# #%%[)9%rc   c                     U R                  5       (       a  SOSnU R                  5        Vs/ s H	  o"SU4   PM     sn$ s  snf )zH
Return an array containing the floating-point values of the positions.
r   r   )is_horizontalr  )r^   possegments      ra   get_positionsEventCollection.get_positions1  sB     %%''aQ/3/@/@/BC/BG3/BCCCs   ?c                    Uc  / n[         R                  " U5      S:w  a  [        S5      eU R                  5       nU R	                  5       nU R                  5       (       a  SOSn[         R                  " [        U5      SS45      n[         R                  " U5      SS2S4   USS2SS2U4'   X#S-  -   USS2SSU-
  4'   X#S-  -
  USS2SSU-
  4'   U R                  U5        g)z Set the positions of the events.Nr   z!positions must be one-dimensionalr   r6   )
rU   r  r   get_lineoffsetget_linelengthr  r  r   sortr  )r^   r  r  r  pos_idxr  s         ra   r  EventCollection.set_positions8  s    I779"@AA((*
((*
))++!88S^Q23"$'')"4QW"=Aw&0>&AAq7{"#&0>&AAq7{"#(#rc   c                     Ub   [        US5      (       a  [        U5      S:X  a  gU R                  5       n[        R                  " U[        R
                  " U5      /5      nU R                  U5        g)z2Add one or more events at the specified positions.Nr   r   )r|   r   r  rU   hstackrV   r  )r^   positionr  s      ra   add_positionsEventCollection.add_positionsG  s[    % 8 8 #H 2&&(	IIy"--*ABC	9%rc   c                     U R                   $ )z=True if the eventcollection is horizontal, False if vertical.)r  rg   s    ra   r  EventCollection.is_horizontalQ  s    """rc   c                 4    U R                  5       (       a  S$ S$ )zH
Return the orientation of the event line ('horizontal' or 'vertical').

horizontalvertical)r  rg   s    ra   get_orientationEventCollection.get_orientationU  s      $1133|CCrc   c                     U R                  5       n[        U5       H  u  p#[        R                  " U5      X'   M     U R	                  U5        U R                  5       (       + U l        SU l        g)z^
Switch the orientation of the event line, either from vertical to
horizontal or vice versus.
TN)r  	enumeraterU   fliplrr  r  r  rn   )r^   r  ir  s       ra   switch_orientation"EventCollection.switch_orientation[  s\    
 $$&#H-JA))G,HK .(#"&"4"4"66
rc   c                 |    [         R                  " SSS.US9nX R                  5       :X  a  gU R                  5         g)zh
Set the orientation of the event line.

Parameters
----------
orientation : {'horizontal', 'vertical'}
TF)r  r  )r  N)r   check_getitemr  r  )r^   r  r  s      ra   r  EventCollection.set_orientationg  s?     **U3#% ..00!rc   c                     U R                   $ )z7Return the length of the lines used to mark each event.)r  rg   s    ra   r  EventCollection.get_linelengthv      rc   c                    XR                  5       :X  a  gU R                  5       nU R                  5       nU R                  5       (       a  SOSnU H  nX!S-  -   USU4'   X!S-  -
  USU4'   M     U R	                  U5        Xl        g)z4Set the length of the lines used to mark each event.Nr   r          @)r  r  r  r  r  r  )r^   r  r  r  r  r  s         ra   set_linelengthEventCollection.set_linelengthz      ,,..((*
$$&%%''aQG(?:GAsFO(?:GAsFO   	(#%rc   c                     U R                   $ )z7Return the offset of the lines used to mark each event.)r  rg   s    ra   r  EventCollection.get_lineoffset  r  rc   c                    XR                  5       :X  a  gU R                  5       nU R                  5       nU R                  5       (       a  SOSnU H  nXS-  -   USU4'   XS-  -
  USU4'   M     U R	                  U5        Xl        g)z4Set the offset of the lines used to mark each event.Nr   r   r  )r  r  r  r  r  r  )r^   r  r  r  r  r  s         ra   set_lineoffsetEventCollection.set_lineoffset  r   rc   c                 &   > [         TU ]  5       S   $ )z3Get the width of the lines used to mark each event.r   r7   rv  r^   r`   s    ra   rv  EventCollection.get_linewidth  s    w$&q))rc   c                     > [         TU ]  5       $ re   r  r  s    ra   r  EventCollection.get_linewidths  s    w$&&rc   c                 (    U R                  5       S   $ )z6Return the color of the lines used to mark each event.r   )r  rg   s    ra   r  EventCollection.get_color  s     ##rc   )r  r  r  rn   )r  )r   r  r  r  r  rh  r8   r  r  r  extend_positionsappend_positionsr  r  r  r  r  r  r  r  rv  r  r  r  r  r  s   @ra   r  r    s     M *8& "!8& 8&tD$& +87'#D
" & &*'$ $rc   r  c                   J   ^  \ rS rSrSr\R                  S-  rU 4S jrSr	U =r
$ )CircleCollectioni  z-A collection of circles, drawn using splines.rz  c                    > [         TU ]  " S0 UD6  U R                  U5        U R                  [        R
                  " 5       5        [        R                  R                  5       /U l	        g)z
Parameters
----------
sizes : float or array-like
    The area of each circle in points^2.
**kwargs
    Forwarded to `.Collection`.
Nr   )
r7   r8   r  r  r   ry   r   r   unit_circler]   )r^   r  r_   r`   s      ra   r8   CircleCollection.__init__  sO     	"6"u:779:zz--/0rc   rf   )r   r  r  r  r  rU   r  r  r8   r  r  r  s   @ra   r  r    s    7eeoG1 1rc   r  c                      ^  \ rS rSrSrSS.U 4S jjrS rS rS rS	 r	S
 r
S rS r\R                  U 4S j5       rSrU =r$ )EllipseCollectioni  z.A collection of ellipses, drawn using splines.points)unitsc                ^  > [         TU ]  " S0 UD6  U R                  U5        U R                  U5        U R	                  U5        X@l        U R                  [        R                  " 5       5        [        R                  " S5      U l        [        R                  R                  5       /U l        g)a  
Parameters
----------
widths : array-like
    The lengths of the first axes (e.g., major axis lengths).
heights : array-like
    The lengths of second axes.
angles : array-like
    The angles of the first axes, degrees CCW from the x-axis.
units : {'points', 'inches', 'dots', 'width', 'height', 'x', 'y', 'xy'}
    The units in which majors and minors are given; 'width' and
    'height' refer to the dimensions of the axes, while 'x' and 'y'
    refer to the *offsets* data units. 'xy' differs from all others in
    that the angle as plotted varies with the aspect ratio, and equals
    the specified angle only when the aspect ratio is unity.  Hence
    it behaves the same as the `~.patches.Ellipse` with
    ``axes.transData`` as its transform.
**kwargs
    Forwarded to `Collection`.
r(   Nr   )r7   r8   
set_widthsset_heights
set_angles_unitsr  r   ry   rU   r  rs   r   r   r  r]   )r^   widthsheightsanglesr  r_   r`   s         ra   r8   EllipseCollection.__init__  s    * 	"6"!:779:88I.zz--/0rc   c                    U R                   nU R                  SS9nU R                  S:X  a  SnGO3U R                  S:X  a.  UR                  R                  UR
                  R                  -  nOU R                  S:X  a.  UR                  R                  UR
                  R                  -  nOU R                  S:X  a  UR                  nOU R                  S:X  a  UR                  S	-  nOzU R                  S
:X  a  UR                  R                  nOSU R                  S:X  a  UR                  R                  nO,U R                  S:X  a  SnO[        SU R                  < 35      e[        R                  " [        U R                  5      SS45      U l        U R                  U-  nU R                  U-  n[        R                  " U R                   5      n[        R"                  " U R                   5      nXG-  U R                  SS2SS4'   XV* -  U R                  SS2SS4'   XF-  U R                  SS2SS4'   XW-  U R                  SS2SS4'   SU R                  SS2SS4'   [$        R&                  nU R                  S:X  aY  UR(                  R+                  5       R-                  5       R/                  5       n	SU	SS2SS24'   U R1                  U" U	5      5        gg)z0Calculate transforms immediately before drawing.Fr   r  r   r   r   inchesr  r  r   r   dotsr  zUnrecognized units: r)   Nr   r6   )r}   r   r  r   r   viewLimr   r  r   rU   r  r   _widthsrs   _heightssin_anglescosr   r   r   r   r  copyr  )
r^   axfigscr  r  	sin_angle	cos_angle_affinems
             ra   _set_transforms!EllipseCollection._set_transforms  sH    YYoo5o);;$B[[C!1!11B[[C"**"3"33B[[H$B[[H$4B[[G#B[[H$B[[F"B3DKK?CDD88S%61$=>"--"$FF4<<(	FF4<<(	$*$6Aq!$+j$8Aq!$*$6Aq!$+$7Aq!$'Aq!%%;;$'')446;;=AAbqb!"fIwqz* rc   c                 j    S[         R                  " U5      R                  5       -  U l        SU l        g)z5Set the lengths of the first axes (e.g., major axis).      ?TN)rU   rD  ravelr&  rn   )r^   r  s     ra   r  EllipseCollection.set_widths  s'    RZZ/5577
rc   c                 j    S[         R                  " U5      R                  5       -  U l        SU l        g)2Set the lengths of second axes (e.g., minor axes).r6  TN)rU   rD  r7  r'  rn   )r^   r  s     ra   r  EllipseCollection.set_heights  s'    bjj17799
rc   c                 d    [         R                  " U5      R                  5       U l        SU l        g)z>Set the angles of the first axes, degrees CCW from the x-axis.TN)rU   deg2radr7  r)  rn   )r^   r   s     ra   r  EllipseCollection.set_angles  s"    zz&)//1
rc   c                      U R                   S-  $ )z5Get the lengths of the first axes (e.g., major axis).r6   )r&  rg   s    ra   
get_widthsEllipseCollection.get_widths  s    ||arc   c                      U R                   S-  $ )r:  r6   )r'  rg   s    ra   get_heightsEllipseCollection.get_heights  s    }}q  rc   c                 B    [         R                  " U R                  5      $ )z>Get the angles of the first axes, degrees CCW from the x-axis.)rU   rad2degr)  rg   s    ra   
get_anglesEllipseCollection.get_angles  s    zz$,,''rc   c                 D   > U R                  5         [        TU ]	  U5        g re   )r3  r7   r   r  s     ra   r   EllipseCollection.draw  s    Xrc   )r)  r'  r]   rs   r  r&  rn   )r   r  r  r  r  r8   r3  r  r  r  r@  rC  rG  r   r  r   r  r  r  s   @ra   r  r    sQ    89A 1 1<(+T


 !(   rc   r  c                   :   ^  \ rS rSrSrSS.U 4S jjrS rSrU =r$ )PatchCollectioni$  z
A generic collection of patches.

PatchCollection draws faster than a large number of equivalent individual
Patches. It also makes it easier to assign a colormap to a heterogeneous
collection of patches.
F)match_originalc                  > U(       a  S nU Vs/ s H
  oT" U5      PM     snUS'   U Vs/ s H  oUR                  5       PM     snUS'   U Vs/ s H  oUR                  5       PM     snUS'   U Vs/ s H  oUR                  5       PM     snUS'   U Vs/ s H  oUR                  5       PM     snUS'   [        TU ]  " S0 UD6  U R                  U5        gs  snf s  snf s  snf s  snf s  snf )	a  
Parameters
----------
patches : list of `.Patch`
    A sequence of Patch objects.  This list may include
    a heterogeneous assortment of different patch types.

match_original : bool, default: False
    If True, use the colors and linewidths of the original
    patches.  If False, new colors may be assigned by
    providing the standard collection arguments, facecolor,
    edgecolor, linewidths, norm or cmap.

**kwargs
    All other parameters are forwarded to `.Collection`.

    If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds*
    are None, they default to their `.rcParams` patch setting, in
    sequence form.

Notes
-----
The use of `~matplotlib.cm.ScalarMappable` functionality is optional.
If the `~matplotlib.cm.ScalarMappable` matrix ``_A`` has been set (via
a call to `~.ScalarMappable.set_array`), at draw time a call to scalar
mappable will be made to set the face colors.
c                 T    U R                  5       (       a  U R                  5       $ / SQ$ )N)r   r   r   r   )r  r   )patchs    ra   determine_facecolor5PatchCollection.__init__.<locals>.determine_facecolorK  s$    >>## ..00##rc   r   r   r   r   r   Nr   )r   rv  ry  r@  r7   r8   rp   )r^   patchesrM  r_   rQ  r   r`   s         ra   r8   PatchCollection.__init__-  s    : $
 EL#LGq$7$:G#LF< ?F#Gw!OO$5w#GF< ?F#Gw!OO$5w#GF< ?F#Gw!OO$5w#GF< CJ%K7a&7&7&97%KF>""6"w $M#G#G#G%Ks   CCC1C$C)c                     U Vs/ s H0  nUR                  5       R                  UR                  5       5      PM2     nnX0l        g s  snf re   )r   transform_pathget_pathr]   )r^   rS  r   ro   s       ra   rp   PatchCollection.set_pathsZ  sD    !#!Q "11!**,?! 	 ##s   7Arf   )	r   r  r  r  r  r8   rp   r  r  r  s   @ra   rL  rL  $  s"     38 +  + Z rc   rL  c                   l   ^  \ rS rSrSrU 4S jrS rS r\S 5       r	\
R                  S 5       rSrU =r$ )	TriMeshi`  z
Class for the efficient drawing of a triangular mesh using Gouraud shading.

A triangular mesh is a `~matplotlib.tri.Triangulation` object.
c                 T  > [         TU ]  " S0 UD6  Xl        SU l        [        R
                  R                  5       U l        [        R                  " UR                  R                  SS5      UR                  R                  SS5      45      nU R                  R                  U5        g )Ngouraudr  r   r   )r7   r8   _triangulation_shadingr   r   unitr5  rU   r  r   r  r   r   )r^   triangulationr_   r  r`   s       ra   r8   TriMesh.__init__f  s    "6"+!__))+
 YY//A6%//A68 9

&&r*rc   c                 T    U R                   c  U R                  5         U R                   $ re   r]   rp   rg   s    ra   rh   TriMesh.get_pathss       ;;NN{{rc   c                 D    U R                  U R                  5      U l        g re   )convert_mesh_to_pathsr]  r]   rg   s    ra   rp   TriMesh.set_pathsx  s    001D1DErc   c                     U R                  5       n[        R                  " U R                  U   U R                  U   4SS9nU Vs/ s H  n[
        R                  " U5      PM     sn$ s  snf )z
Convert a given mesh into a sequence of `.Path` objects.

This function is primarily of use to implementers of backends that do
not directly support meshes.
r  r  )get_masked_trianglesrU   r?  r   r   r   r   )tri	trianglesr  r   s       ra   rg  TriMesh.convert_mesh_to_paths{  sY     ,,.	#%%	*CEE),<=BG',-u!

1u---s    A)c                    U R                  5       (       d  g UR                  U R                  R                  U R	                  5       S9  U R                  5       nU R                  nUR                  5       n[        R                  " UR                  U   UR                  U   4SS9nU R                  5         U R                  U   nUR                  5       nU R                  U5        UR!                  U R#                  5       S   5        UR%                  XuXbR'                  5       5        UR)                  5         UR+                  U R                  R                  5        g )N)gidr  r  r   )r   r   r`   r   r   r   r]  rj  rU   r?  r   r   r   rT  r   r   rJ   rv  draw_gouraud_trianglesr   r   r   )r^   r   r   rk  rl  r  r   r   s           ra   r   TriMesh.draw  s   !!DNN33H&&(	 !!,,.	#%%	*CEE),<=BG""$!!),__"
++-a01''6;K;K;MN


T^^445rc   )r5  r]   r^  r]  )r   r  r  r  r  r8   rh   rp   r  rg  r   r  r   r  r  r  s   @ra   rZ  rZ  `  sF    
+
F 	. 	. 6  6rc   rZ  c                   n   ^  \ rS rSrSrSS.S jrU 4S jrS rU 4S jrU 4S	 jr	\
S
 5       rS rSrU =r$ )r  i  aN  
Class for managing the two dimensional coordinates of Quadrilateral meshes
and the associated data with them. This class is a mixin and is intended to
be used with another collection that will implement the draw separately.

A quadrilateral mesh is a grid of M by N adjacent quadrilaterals that are
defined via a (M+1, N+1) grid of vertices. The quadrilateral (m, n) is
defined by the vertices ::

           (m+1, n) ----------- (m+1, n+1)
              /                   /
             /                 /
            /               /
        (m, n) -------- (m, n+1)

The mesh need not be regular and the polygons need not be convex.

Parameters
----------
coordinates : (M+1, N+1, 2) array-like
    The vertices. ``coordinates[m, n]`` specifies the (x, y) coordinates
    of vertex (m, n).

shading : {'flat', 'gouraud'}, default: 'flat'
flat)shadingc                F    [         R                  " SUS9  Xl        X l        g )N)NNr6   coordinates)r   check_shape_coordinatesr^  )r^   rw  rt  s      ra   r8   _MeshData.__init__  s    kB'rc   c                 ~  > U R                   R                  SS u  p#U R                  S:X  a
  US-
  US-
  pTOX#pTXES4XES4XE4XE-  4/nUbf  [        R                  " U5      nXv;  aK  [	        SU SU S	U R                   S
SR                  [        [        U5      5       SUR                   3
5      e[        TU ]%  U5      $ )a  
Set the data values.

Parameters
----------
A : array-like
    The mesh data. Supported array shapes are:

    - (M, N) or (M*N,): a mesh with scalar data. The values are mapped
      to colors using normalization and a colormap. See parameters
      *norm*, *cmap*, *vmin*, *vmax*.
    - (M, N, 3): an image with RGB values (0-1 float or 0-255 int).
    - (M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
      i.e. including transparency.

    If the values are provided as a 2D grid, the shape must match the
    coordinates grid. If the values are 1D, they are reshaped to 2D.
    M, N follow from the coordinates grid, where the coordinates grid
    shape is (M, N) for 'gouraud' *shading* and (M+1, N+1) for 'flat'
    shading.
r   r  rs  r   r)      zFor X (z	) and Y (z) with z shading, A should have shape z or z, not )
ry  rX   r^  rU   r   joinrK  rZ  r7   	set_array)	r^   Ar   r   r  w	ok_shapesrX   r`   s	           ra   r~  _MeshData.set_array  s    , ))//"5==F"A:uqyqqAYq	A6AE8<	=HHQKE% eWIfXWT]]O L4{{3sI#678qwwiIJ J w ##rc   c                     U R                   $ )z
Return the vertices of the mesh as an (M+1, N+1, 2) array.

M, N are the number of quadrilaterals in the rows / columns of the
mesh, corresponding to (M+1, N+1) vertices.
The last dimension specifies the components (x, y).
)ry  rg   s    ra   get_coordinates_MeshData.get_coordinates  s        rc   c                 @   > [         TU ]  5       R                  SS5      $ Nr  r|  )r7   r   r  r  s    ra   r   _MeshData.get_edgecolor        w$&..r155rc   c                 @   > [         TU ]  5       R                  SS5      $ r  )r7   r   r  r  s    ra   r   _MeshData.get_facecolor  r  rc   c           
      v   [        U [        R                  R                  5      (       a  U R                  nOU n[        R
                  " USS2SS24   USS2SS24   USS2SS24   USS2SS24   USS2SS24   /SS9R                  S5      nU Vs/ s H  n[        R                  " U5      PM     sn$ s  snf )z
Convert a given mesh into a sequence of `.Path` objects.

This function is primarily of use to implementers of backends that do
not directly support quadmeshes.
Nr  r   r6   r  )r  r  r6   )	rz   rU   r   r   datar  r  r   r   )rw  rK  r  r   s       ra   _convert_mesh_to_paths _MeshData._convert_mesh_to_paths  s     k255#4#455  AAcrc3B3hKcrc12gJab!"fIab#2#gJcrc3B3hK!
  7:& 	 (..v!

1v...s    B6c                 d   [        U[        R                  R                  5      (       a  UR                  nOUnUSS2SS24   nUSS2SS24   nUSS2SS24   nUSS2SS24   nX4-   U-   U-   S-  n[        R
                  " X4UXEUXVUXcU/SS9R                  S5      nU R                  5       R                  / UR                  SS QSP75      n	U R                  5       n
[        R                  R                  U
5      (       a  U
R                  OSnUb  [        R                  XS	4'   U	SS2SS24   nU	SS2SS24   nU	SS2SS24   nU	SS2SS24   nX-   U-   U-   S-  n[        R
                  " XUXUXUXU/SS9R                  S
5      n[        R                  " US   5      nUU)    UU)    4$ )z
Convert a given mesh into a sequence of triangles, each point
with its own color.  The result can be used to construct a call to
`~.RendererBase.draw_gouraud_triangles`.
Nr  r   g      @r6   r  )r  r)   r6   r|  r)   )r  r)   r|  ).r6   r)   )rz   rU   r   r   r  r  r  r   rX   r  rd  r   r   isnan)r^   rw  r   p_ap_bp_cp_dp_centerrl  rK  zr   c_ac_bc_cc_dc_centerr   tmasks                      ra   _convert_mesh_to_triangles$_MeshData._convert_mesh_to_triangles	  s    k255#4#455  AASbSkQRjABiCRCjIOc)S0NNhhhh	$

 
 7:& 	  (()D;+<+<Ra+@)D!)DENN++qvvAAgJSbSkQRjABiCRCjIOc)S0hhhh	!

 
 7:& 	 	*+% &%.00rc   )ry  r^  )r   r  r  r  r  r8   r~  r  r   r   r  r  r  r  r  r  s   @ra   r  r    sE    2 06  
#$J!66 / /((1 (1rc   r  c                   r   ^  \ rS rSrSrSSS.U 4S jjrS rS rS	 r\	R                  S
 5       rS rSrU =r$ )QuadMeshi9	  a  
Class for the efficient drawing of a quadrilateral mesh.

A quadrilateral mesh is a grid of M by N adjacent quadrilaterals that are
defined via a (M+1, N+1) grid of vertices. The quadrilateral (m, n) is
defined by the vertices ::

           (m+1, n) ----------- (m+1, n+1)
              /                   /
             /                 /
            /               /
        (m, n) -------- (m, n+1)

The mesh need not be regular and the polygons need not be convex.

Parameters
----------
coordinates : (M+1, N+1, 2) array-like
    The vertices. ``coordinates[m, n]`` specifies the (x, y) coordinates
    of vertex (m, n).

antialiased : bool, default: True

shading : {'flat', 'gouraud'}, default: 'flat'

Notes
-----
Unlike other `.Collection`\s, the default *pickradius* of `.QuadMesh` is 0,
i.e. `~.Artist.contains` checks whether the test point is within any of the
mesh quadrilaterals.

Trs  )r   rt  c                P  > UR                  SS5        [        TU ]	  XS9  [        R                  " U 40 UD6  X l        [
        R                  R                  5       U l        U R                  R                  U R                  R                  SS5      5        U R                  S5        g )Nr0   r   )rw  rt  r  r6   F)r  r7   r8   r&   _antialiasedr   r   r_  r5  r   ry  r  set_mouseover)r^   rw  r   rt  r_   r`   s        ra   r8   QuadMesh.__init__[	  s    ,*[BD+F+'__))+


&&t'8'8'@'@Q'GH5!rc   c                 T    U R                   c  U R                  5         U R                   $ re   rc  rg   s    ra   rh   QuadMesh.get_pathsf	  re  rc   c                 R    U R                  U R                  5      U l        SU l        g rl   )r  ry  r]   rn   rg   s    ra   rp   QuadMesh.set_pathsk	  s!    11$2C2CD
rc   c                 Z    U R                  5       U-
  R                  U R                  5      $ re   )r   transform_bboxr5  )r^   r   s     ra   r   QuadMesh.get_datalimo	  s%    ""$y0@@LLrc   c                    U R                  5       (       d  g UR                  U R                  R                  U R	                  5       5        U R                  5       nU R                  5       nU R                  5       nU R                  5       (       aG  U R                  US S 2S4   5      nU R                  US S 2S4   5      n[        R                  " XV/5      nU R                  5         UR                  (       dg  U R                  R!                  S5      nUR#                  U5      nUR!                  U R                  R$                  5      n[&        R(                  " 5       nOU R                  nUR                  (       d!  UR+                  U5      nUR-                  5       nUR/                  5       nUR1                  U R3                  5       5        U R5                  U5        UR7                  U R9                  5       S   5        U R:                  S:X  a4  U R=                  U5      u  pUR?                  XXRA                  5       5        OURC                  XRA                  5       UR$                  S   S-
  UR$                  S   S-
  XtUU RE                  5       R!                  S5      U RF                  U RI                  5       R!                  S5      5
        URK                  5         URM                  U R                  R                  5        SU l'        g )Nr   r   )r  r6   r\  )r  r|  F)(r   r   r`   r   r   r   r~   r   r   r   r   rU   r   r   r   ry  r  r   rX   r   ry   r   r   r   r   r   r   rJ   rv  r^  r  rp  r   draw_quad_meshr   r  get_edgecolorsr   r   rn   )r^   r   r   r   r-   r   r   rw  r   rl  r   s              ra   r   QuadMesh.drawr	  sl   !!DNN33T\\^D&&(	..0
""$??$$WQT]3B$$WQT]3Boorh/G""$""++33G<K#--k:K%--d.?.?.E.EFK"446I++K## 55g>G#..0J__
DMMO$"
++-a01==I% $ ? ? LI++v'7'7'9; ##$$&!!!$q(+*;*;A*>*Bj""$,,W5!!4#6#6#8#@#@#IK 	

T^^445
rc   c                     U R                  U5      u  p#U(       a5  U R                  5       b$  U R                  5       R                  5       US      $ g )Nr   )r   r  r7  )r^   event	containedinfos       ra   get_cursor_dataQuadMesh.get_cursor_data	  sC    --.	)5>>#))+DK88rc   )r  r5  r]   rn   )r   r  r  r  r  r8   rh   rp   r   r   r  r   r  r  r  r  s   @ra   r  r  9	  sO    B 48 	" 	"
M .  .` rc   r  c                   \   ^  \ rS rSrSrU 4S jrS rS rU 4S jrU 4S jr	U 4S jr
S	rU =r$ )
PolyQuadMeshi	  a  
Class for drawing a quadrilateral mesh as individual Polygons.

A quadrilateral mesh is a grid of M by N adjacent quadrilaterals that are
defined via a (M+1, N+1) grid of vertices. The quadrilateral (m, n) is
defined by the vertices ::

           (m+1, n) ----------- (m+1, n+1)
              /                   /
             /                 /
            /               /
        (m, n) -------- (m, n+1)

The mesh need not be regular and the polygons need not be convex.

Parameters
----------
coordinates : (M+1, N+1, 2) array-like
    The vertices. ``coordinates[m, n]`` specifies the (x, y) coordinates
    of vertex (m, n).

Notes
-----
Unlike `.QuadMesh`, this class will draw each cell as an individual Polygon.
This is significantly slower, but allows for more flexibility when wanting
to add additional properties to the cells, such as hatching.

Another difference from `.QuadMesh` is that if any of the vertices or data
of a cell are masked, that Polygon will **not** be drawn and it won't be in
the list of paths returned.
c                 r   > [         TU ]  US9  [        R                  " U 4S/ 0UD6  U R                  5         g )Nrv  r  )r7   r8   r  _set_unmasked_verts)r^   rw  r_   r`   s      ra   r8   PolyQuadMesh.__init__	  s9    [19B9&9 	  "rc   c                 2   [         R                  " [         R                  R                  U R                  5      SS9nUSS2SS24   USS2SS24   -  USS2SS24   -  USS2SS24   -  nU R                  5       nUb  [         R                  R                  U5      nUR                  S:X  a  U[         R                  " USS9-  nU) $ UR                  S:X  a  X-  nU) $ XR                  U R                  SS2SS2SS24   R                  SS 5      -  nU) $ )z8Get the unmasked regions using the coordinates and arrayr  r  r   r   Nr)   r6   )	rU   r   r   rL  ry  r  r  r  rX   )r^   r   r  s      ra   _get_unmasked_polys PolyQuadMesh._get_unmasked_polys	  s#    vvbee(():):;"E QrT1R4Z 4AB</$qtQRx.@4AbD>Qnn?%%$$S)Cxx1}s,,
 u	 Q u D$5$5crc3B3k$B$H$H!$LMMurc   c                    U R                   S   nU R                   S   nU R                  5       n[        R                  R	                  US S2S S24   5      U   n[        R                  R	                  US S2S S24   5      U   n[        R                  R	                  USS 2S S24   5      U   n[        R                  R	                  USS 2S S24   5      U   n[        R                  R	                  USS 2SS 24   5      U   n[        R                  R	                  USS 2SS 24   5      U   n	[        R                  R	                  US S2SS 24   5      U   n
[        R                  R	                  US S2SS 24   5      U   n[        U5      n[        R                  R                  XEXgXXXE/
SS9nUR                  USS45      nU R                  U5        g )N).r   ).r   r  r   r  r  r6   )	ry  r  rU   r   r   r   r?  r  r  )r^   XYunmaskX1Y1X2Y2X3Y3X4Y4npolyr  r  s                  ra   r   PolyQuadMesh._set_unmasked_verts	  s   f%f%))+UU\\!CRC"H+&v.UU\\!CRC"H+&v.UU\\!ABG*%f-UU\\!ABG*%f-UU\\!ABF)$V,UU\\!ABF)$V,UU\\!CRCG*%f-UU\\!CRCG*%f-BUU[["""""A[K

E1a=)urc   c                    > [         TU ]  5       nU R                  5       R                  5       n[	        U5      [	        U5      :w  a  U$ XS S 24   $ re   )r7   r   r  r7  r   )r^   r   unmasked_polysr`   s      ra   r   PolyQuadMesh.get_edgecolor	  M     W"$11399;r7c.))I!#$$rc   c                    > [         TU ]  5       nU R                  5       R                  5       n[	        U5      [	        U5      :w  a  U$ XS S 24   $ re   )r7   r   r  r7  r   )r^   r   r  r`   s      ra   r   PolyQuadMesh.get_facecolor
  r  rc   c                    > U R                  5       n[        TU ]	  U5        [        R                  " X R                  5       5      (       d  U R                  5         g g re   )r  r7   r~  rU   array_equalr  )r^   r  prev_unmaskr`   s      ra   r~  PolyQuadMesh.set_array
  sJ    ..0! ~~k+C+C+EFF$$& Grc   r   )r   r  r  r  r  r8   r  r  r   r   r~  r  r  r  s   @ra   r  r  	  s,    @#&&	%	%' 'rc   r  )3r  r  rH  r5  numbersr   r   r  numpyrU   
matplotlibrD   r  r   r   r   r	   r
   
mcolorizerr   rB   r   r   r  r   r"  r   r   r   _enumsr   r   define_aliasesColorizingArtistr&   r  r  r  r  ry  r  r  r  r  r  r  rL  rZ  r  r  r  r   rc   ra   <module>r     s  	        X X X X '
 "D)%%/%& f,, ffR,: ,^e) ePN) Nbo@ o@d?(0 ?(D31 3
7 5 7
w#Z w#tt$n t$n1+ 1(i
 iX9j 9x<6j <6~W1 W1tny* nbl'9n l'rc   