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

1197 lines
75 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
U<>]<5D>t<00>@s<>dZddlZddlmZddlZddlmZmZddl m
Z
ddl m Z m Z mZddlmZGd d
<EFBFBD>d
e<11>ZGd d <0C>d e<11>ZGd d<0E>de<13>ZGdd<10>de<14>ZGdd<12>de<14>ZGdd<14>de<14>ZGdd<16>de<14>ZGdd<18>de<14>ZGdd<1A>de<13>ZGdd<1C>de<14>ZGdd<1E>de<13>ZGdd <20>d e<14>ZGd!d"<22>d"e<1D>ZGd#d$<24>d$e<11>ZGd%d&<26>d&e<1D>Z Gd'd(<28>d(e <20>Z!Gd)d*<2A>d*e<1D>Z"Gd+d,<2C>d,e<1D>Z#Gd-d.<2E>d.e<14>Z$dS)/a<>
GUI neutral widgets
===================
Widgets that are designed to work for any of the GUI backends.
All of these widgets require you to predefine a :class:`matplotlib.axes.Axes`
instance and pass that as the first arg. matplotlib doesn't try to
be too smart with respect to layout -- you will have to figure out how
wide and tall you want your Axes to be to accommodate your widget.
<EFBFBD>N)<01>Integral<61>)<02>cbook<6F>rcParams)<01>Line2D)<03>Circle<6C> Rectangle<6C>Ellipse)<01>blended_transform_factoryc@s@eZdZdZdd<03>Zdd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Z dS)<0F>LockDrawa<77>
Some widgets, like the cursor, draw onto the canvas, and this is not
desirable under all circumstances, like when the toolbar is in zoom-to-rect
mode and drawing a rectangle. To avoid this, a widget can acquire a
canvas' lock with ``canvas.widgetlock(widget)`` before drawing on the
canvas; this will prevent other widgets from doing so at the same time (if
they also try to acquire the lock first).
cCs
d|_dS)N)<01>_owner)<01>self<6C>r<00>:/tmp/pip-install-i8dhxrtk/matplotlib/matplotlib/widgets.py<70>__init__!szLockDraw.__init__cCs|<00>|<01>std<01><01>||_dS)zReserve the lock for *o*.zalready lockedN)<03> available<6C>
ValueErrorr )r <00>orrr<00>__call__$s
zLockDraw.__call__cCs|<00>|<01>std<01><01>d|_dS)zRelease the lock from *o*.zyou do not own this lockN)rrr )r rrrr<00>release*s
zLockDraw.releasecCs|<00><00> p|<00>|<01>S)z+Return whether drawing is available to *o*.)<02>locked<65>isowner)r rrrrr0szLockDraw.availablecCs
|j|kS)z"Return whether *o* owns this lock.)r )r rrrrr4szLockDraw.isownercCs
|jdk S)z6Return whether the lock is currently held by an owner.N)r )r rrrr8szLockDraw.lockedN)
<EFBFBD>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rrrrrrrrrrr sr c@sFeZdZdZdZdZdZdd<04>Zdd<06>Ze edd<08>d d
<EFBFBD>Z
d d <0C>Z d S)<0E>Widgetz5
Abstract base class for GUI neutral widgets
TcCs
||_dS)z*Set whether the widget is active.
N)<01>_active)r <00>activerrr<00>
set_activeEszWidget.set_activecCs|jS)z*Get whether the widget is active.
)r)r rrr<00>
get_activeJszWidget.get_activecCs
|<00>|<01>S)N)r)r rrrr<00><lambda>P<00>zWidget.<lambda>zIs the widget active?)<01>doccCs|j S)z<>Return True if event should be ignored.
This method (or a version of it) should be called at the beginning
of any event callback.
)r)r <00>eventrrr<00>ignoreSsz Widget.ignoreN) rrrr<00>drawon<6F>eventsonrrr <00>propertyrr%rrrrr=s
rc@s(eZdZdZdd<03>Zdd<05>Zdd<07>ZdS) <09>
AxesWidgetaWidget that is connected to a single
:class:`~matplotlib.axes.Axes`.
To guarantee that the widget remains responsive and not garbage-collected,
a reference to the object should be maintained by the user.
This is necessary because the callback registry
maintains only weak-refs to the functions, which are member
functions of the widget. If there are no references to the widget
object it may be garbage collected which will disconnect the
callbacks.
Attributes:
*ax* : :class:`~matplotlib.axes.Axes`
The parent axes for the widget
*canvas* : :class:`~matplotlib.backend_bases.FigureCanvasBase` subclass
The parent figure canvas for the widget.
*active* : bool
If False, the widget does not respond to events.
cCs||_|jj|_g|_dS)N)<04>ax<61>figure<72>canvas<61>cids)r r*rrrrrs
zAxesWidget.__init__cCs|j<00>||<02>}|j<02>|<03>dS)z<>Connect callback with an event.
This should be used in lieu of `figure.canvas.mpl_connect` since this
function stores callback ids for later clean up.
N)r,<00> mpl_connectr-<00>append)r r$<00>callback<63>cidrrr<00> connect_eventwszAxesWidget.connect_eventcCs x|jD]}|j<01>|<01>qWdS)z-Disconnect all events created by this widget.N)r-r,<00>mpl_disconnect)r <00>crrr<00>disconnect_events<74>s zAxesWidget.disconnect_eventsN)rrrrrr2r5rrrrr)\s r)c@sBeZdZdZddd<06>Zdd<08>Zd d
<EFBFBD>Zd d <0C>Zd d<0E>Zdd<10>Z dS)<12>Buttona<6E>
A GUI neutral button.
For the button to remain responsive you must keep a reference to it.
Call :meth:`on_clicked` to connect to the button.
Attributes
----------
ax
The :class:`matplotlib.axes.Axes` the button renders into.
label
A :class:`matplotlib.text.Text` instance.
color
The color of the button when not hovering.
hovercolor
The color of the button when hovering.
N<>0.85<EFBFBD>0.95cCs<>t<00>||<01>|dk r|<01>|<03>|jdd|dd|jd<04>|_d|_i|_|<00>d|j <09>|<00>d|j
<EFBFBD>|<00>d|j <0B>|<01> d <09>|<01> |<04>|<01>g<00>|<01>g<00>||_||_||_dS)
a}
Parameters
----------
ax : matplotlib.axes.Axes
The :class:`matplotlib.axes.Axes` instance the button
will be placed into.
label : str
The button text. Accepts string.
image : array, mpl image, Pillow Image
The image to place in the button, if not *None*.
Can be any legal arg to imshow (numpy array,
matplotlib Image instance, or Pillow Image).
color : color
The color of the button when not activated
hovercolor : color
The color of the button when the mouse is over it
Ng<00>?<3F>center)<03>verticalalignment<6E>horizontalalignment<6E> transformr<00>button_press_event<6E>button_release_event<6E>motion_notify_eventF)r)rZimshow<6F>text<78> transAxes<65>label<65>cnt<6E> observersr2<00>_click<63>_release<73>_motion<6F> set_navigate<74> set_facecolor<6F>
set_xticks<EFBFBD>
set_yticks<EFBFBD>color<6F>
hovercolor<EFBFBD>
_lastcolor)r r*rB<00>imagerLrMrrrr<00>s& 

 



zButton.__init__cCsH|<00>|<01>rdS|j|jkrdS|js(dS|jj|jkrD|j<04>|j<02>dS)N)r%<00>inaxesr*r'r,<00> mouse_grabber<65>
grab_mouse)r r$rrrrE<00>s
 z Button._clickcCsl|<00>|<01>rdS|jj|jkr dS|j<01>|j<03>|js8dS|j|jkrHdSx|j<07><08>D]\}}||<01>qTWdS)N) r%r,rQr*<00> release_mouser'rPrD<00>items)r r$r1<00>funcrrrrF<00>s
 zButton._releasecCs\|<00>|<01>rdS|j|jkr"|j}n|j}||jkrX|j<02>|<02>||_|jrX|jjj <09>
<EFBFBD>dS)N) r%rPr*rMrLrNrIr&r+r,<00>draw)r r$r4rrrrG<00>s
 
 zButton._motioncCs"|j}||j|<|jd7_|S)z<>
Connect the callback function *func* to button click events.
Returns a connection id, which can be used to disconnect the callback.
r)rCrD)r rUr1rrr<00>
on_clicked<EFBFBD>s
zButton.on_clickedcCs&y |j|=Wntk
r YnXdS)z6Remove the callback function with connection id *cid*.N)rD<00>KeyError)r r1rrr<00>
disconnect<EFBFBD>s zButton.disconnect)Nr7r8)
rrrrrrErFrGrWrYrrrrr6<00>s
.
   r6c @sJeZdZdZddd<08>Zd d
<EFBFBD>Zd d <0C>Zd d<0E>Zdd<10>Zdd<12>Z dd<14>Z
dS)<16>SlideraB
A slider representing a floating point range.
Create a slider from *valmin* to *valmax* in axes *ax*. For the slider to
remain responsive you must maintain a reference to it. Call
:meth:`on_changed` to connect to the slider event.
Attributes
----------
val : float
Slider value.
<20><00>?<3F>%1.2fTN<EFBFBD>
horizontalcKs6t<00>||<01>| dk r0t| d<02>s0td<03>t| <09><01><01><01>|
dk rTt|
d<02>sTtd<04>t|
<EFBFBD><01><01><01>| dkrjtd<06>| <0A><01><01>| |_||_||_| |_ |
|_
d|_ ||_ ||_ | |_|<00>|<05>}|dkr<>|}||_||_| dkr<>|j||d d
f|<0E>|_|j|d d
d d
d <0C>|_n,|j||d d
f|<0E>|_|j|d d
d d
d <0C>|_||_|<01>g<00>| dk<02>rN|<01>||f<02>n|<01>||f<02>|<01>g<00>|<01>d<07>|<00>d |j <20>|<00>d|j <20>| <0B>r<>|<00>d|j <20>| dk<02>r<>|j!dd||j"ddd<14>|_#|j!dd|||j"ddd<14>|_$n8|j!dd||j"ddd<14>|_#|j!dd|||j"ddd<14>|_$d |_%i|_&|<00>'|<05>dS)a<>
Parameters
----------
ax : Axes
The Axes to put the slider in.
label : str
Slider label.
valmin : float
The minimum value of the slider.
valmax : float
The maximum value of the slider.
valinit : float, optional, default: 0.5
The slider initial position.
valfmt : str, optional, default: "%1.2f"
Used to format the slider value, fprint format string.
closedmin : bool, optional, default: True
Indicate whether the slider interval is closed on the bottom.
closedmax : bool, optional, default: True
Indicate whether the slider interval is closed on the top.
slidermin : Slider, optional, default: None
Do not allow the current slider to have a value less than
the value of the Slider `slidermin`.
slidermax : Slider, optional, default: None
Do not allow the current slider to have a value greater than
the value of the Slider `slidermax`.
dragging : bool, optional, default: True
If True the slider can be dragged by the mouse.
valstep : float, optional, default: None
If given, the slider will snap to multiples of `valstep`.
orientation : str, 'horizontal' or 'vertical', default: 'horizontal'
The orientation of the slider.
Notes
-----
Additional kwargs are passed on to ``self.poly`` which is the
:class:`~matplotlib.patches.Rectangle` that draws the slider
knob. See the :class:`~matplotlib.patches.Rectangle` documentation for
valid property names (e.g., `facecolor`, `edgecolor`, `alpha`).
N<>valz$Argument slidermin ({}) has no 'val'z$Argument slidermax ({}) has no 'val')r]<00>verticalzBArgument orientation ({}) must be either'horizontal' or 'vertical'Fr_rr<00>r)rL<00>lwr=r>r?g<00>?gR<67><1E><>Q<EFBFBD>?<3F>bottomr9)r<r:r;g{<14>G<EFBFBD>z<EFBFBD><7A><EFBFBD>top<6F>right<68>left)(r)r<00>hasattrr<00>format<61>type<70> orientation<6F> closedmin<69> closedmax<61> slidermin<69> slidermax<61> drag_active<76>valmin<69>valmax<61>valstep<65>_value_in_boundsr^<00>valinitZaxhspan<61>poly<6C>axhlineZhlineZaxvspan<61>axvlineZvline<6E>valfmtrK<00>set_ylim<69>set_xlimrJrHr2<00>_updater@rArB<00>valtextrCrD<00>set_val)r r*rBrorprsrwrjrkrlrmZdraggingrqri<00>kwargsrrrr st7   






 

zSlider.__init__cCs<>|jr,t<01>||j|j<00>|j}||j7}||jkrH|js@dS|j}n||jkrb|js\dS|j}|jdk r<>||jjkr<>|js<>dS|jj}|j dk r<>||j jkr<>|js<>dS|j j}|S)z&Makes sure *val* is with given bounds.N)
rq<00>np<6E>roundrorjrprkrlr^rm)r r^rrrrr<00>s(


zSlider._value_in_boundscCs<>|<00>|<01>s|jdkrdS|jdkrB|j|jkrBd|_|j<06>|j<04>|jsLdS|jdksl|jdkr<>|j|jkr<>d|_|j<06>|j<04>dS|j dkr<>|<00>
|j <0B>}n |<00>
|j <0C>}|d|j gkr<>|<00>|<02>dS)zUpdate the slider position.rNr=Tr>Fr_)r%<00>button<6F>namerPr*rnr,rRrSrirr<00>ydata<74>xdatar^r|)r r$r^rrrrz<00>s$

 
 zSlider._updatecCs<>|jj}|jdkr,d|f|d<d|f|d<n|df|d<|df|d<||j_|j<03>|j|<00>|jrr|jjj <09>
<EFBFBD>||_ |j s<>dSx|j <0A><0E>D]\}}||<01>q<>WdS)zf
Set slider value to *val*
Parameters
----------
val : float
r_rr<00><00>N)rt<00>xyrir{Zset_textrwr&r*r+r,<00> draw_idler^r'rDrT)r r^r<>r1rUrrrr|<00>s
   zSlider.set_valcCs"|j}||j|<|jd7_|S)a<>
When the slider value is changed call *func* with the new
slider value
Parameters
----------
func : callable
Function to call when slider is changed.
The function must accept a single float as its arguments.
Returns
-------
cid : int
Connection id (which can be used to disconnect *func*)
r)rCrD)r rUr1rrr<00>
on_changed<EFBFBD>s
zSlider.on_changedcCs&y |j|=Wntk
r YnXdS)z<>
Remove the observer with connection id *cid*
Parameters
----------
cid : int
Connection id of the observer to be removed
N)rDrX)r r1rrrrY<00>s  zSlider.disconnectcCs|j|jkr|<00>|j<01>dS)z%Reset the slider to the initial valueN)r^rsr|)r rrr<00>reset<65>s z Slider.reset) r[r\TTNNTNr]) rrrrrrrrzr|r<>rYr<>rrrrrZ<00>s 
zrZc@sBeZdZdZddd<04>Zdd<06>Zdd<08>Zd d
<EFBFBD>Zd d <0C>Zd d<0E>Z dS)<10> CheckButtonsa<73>
A GUI neutral set of check buttons.
For the check buttons to remain responsive you must keep a
reference to this object.
The following attributes are exposed
*ax*
The :class:`matplotlib.axes.Axes` instance the buttons are
located in
*labels*
List of :class:`matplotlib.text.Text` instances
*lines*
List of (line1, line2) tuples for the x's in the check boxes.
These lines exist for each box, but have ``set_visible(False)``
when its box is not checked.
*rectangles*
List of :class:`matplotlib.patches.Rectangle` instances
Connect to the CheckButtons with the :meth:`on_clicked` method
Nc Cs<>t<00>||<01>|<01>g<00>|<01>g<00>|<01>d<01>|dkr@dgt|<02>}t|<02>dkrtdt|<02>d}t<06>d||t|<02><01>}n
d}dg}|<01><08>}g|_ g|_
g|_ dd|j d d
<EFBFBD>}<07>xt |||<03>D]<5D>\}} }
|jd|| |j d d d <0A>} |d|d} } d|| d}}t||f| | d||j d<11>}t||| g|| |gf|<07>}t||| g||| gf|<07>}|<10>|
<EFBFBD>|<11>|
<EFBFBD>|j <09>| <0B>|j <0B>|<0F>|j
<EFBFBD>||f<02>|<01>|<0F>|<01>|<10>|<01>|<11>q<>W|<00>d|j<16>d|_i|_dS)a<>
Add check buttons to :class:`matplotlib.axes.Axes` instance *ax*
Parameters
----------
ax : `~matplotlib.axes.Axes`
The parent axes for the widget.
labels : List[str]
The labels of the check buttons.
actives : List[bool], optional
The initial check states of the buttons. The list must have the
same length as *labels*. If not given, all buttons are unchecked.
FNrg<00>?g<00>?g<00>?<3F>kg<00>?Zbutt)rL<00> linewidthr<Zsolid_capstylerer9)r<r;r:r<>g<><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F>black)r<><00>width<74>height<68> edgecolor<6F> facecolorr<r=r)r)rrJrKrH<00>lenr~<00>linspace<63> get_facecolor<6F>labels<6C>lines<65>
rectanglesrA<00>zipr@rr<00> set_visibler/<00> add_patch<63>add_liner2<00>_clickedrCrD)r r*r<>Zactives<65>dy<64>ys<79>axcolorZ
lineparams<EFBFBD>yrBr<00>t<>w<>h<>x<>p<>l1<6C>l2rrrrsL 


   

  

zCheckButtons.__init__cCs<>|<00>|<01>s |jdks |j|jkr$dSxVtt|j|j<07><02>D]@\}\}}|<04><08><00> |j
|j <0B>sl|<03><08><00> |j
|j <0B>r8|<00> |<02>Pq8WdS)Nr) r%r<>rPr*<00> enumerater<65>r<>r<><00>get_window_extent<6E>containsr<73>r<>r)r r$<00>ir<69>r<>rrrr<>\s  
zCheckButtons._clickedcCs<>d|krt|j<01>kr*nn td|<00><01>|j|\}}|<02>|<02><05> <00>|<03>|<03><05> <00>|jrl|jjj <09>
<EFBFBD>|j svdSx(|j <0C> <0A>D]\}}||j|<00><0E><00>q<>WdS)a%
Directly (de)activate a check button by index.
*index* is an index into the original label list
that this object was constructed with.
Raises ValueError if *index* is invalid.
Callbacks will be triggered if :attr:`eventson` is True.
rzInvalid CheckButton index: %dN)r<>r<>rr<>r<><00> get_visibler&r*r+r,rVr'rDrT<00>get_text)r <00>indexr<78>r<>r1rUrrrres  zCheckButtons.set_activecCsdd<02>|jD<00>S)zX
Return a tuple of the status (True/False) of all of the check buttons.
cSsg|]\}}|<01><00><00>qSr)r<>)<03>.0r<EFBFBD>r<>rrr<00>
<listcomp><3E>sz+CheckButtons.get_status.<locals>.<listcomp>)r<>)r rrr<00>
get_statusszCheckButtons.get_statuscCs"|j}||j|<|jd7_|S)z<>
Connect the callback function *func* to button click events.
Returns a connection id, which can be used to disconnect the callback.
r)rCrD)r rUr1rrrrW<00>s
zCheckButtons.on_clickedcCs&y |j|=Wntk
r YnXdS)z,remove the observer with connection id *cid*N)rDrX)r r1rrrrY<00>s zCheckButtons.disconnect)N)
rrrrrr<>rr<>rWrYrrrrr<><00>s
D  r<>c@s<>eZdZdZd)dd<07>Zdd <09>Zd
d <0B>Zd d <0A>Zdd<0F>Zdd<11>Z dd<13>Z
dd<15>Z dd<17>Z dd<19>Z dd<1B>Zdd<1D>Zdd<1F>Zd d!<21>Zd"d#<23>Zd$d%<25>Zd&d'<27>Zd(S)*<2A>TextBoxao
A GUI neutral text input box.
For the text box to remain responsive you must keep a reference to it.
The following attributes are accessible:
*ax*
The :class:`matplotlib.axes.Axes` the button renders into.
*label*
A :class:`matplotlib.text.Text` instance.
*color*
The color of the text box when not hovering.
*hovercolor*
The color of the text box when hovering.
Call :meth:`on_text_change` to be updated whenever the text changes.
Call :meth:`on_submit` to be updated whenever the user hits enter or
leaves the text entry field.
<20><00>.95<EFBFBD>1<>{<14>G<EFBFBD>z<EFBFBD>?cCs.t<00>||<01>d|_dd<03>tD<00>|_||_|j| d|dd|jd<07>|_|<00>|j<05>|_ d|_
i|_ i|_ |j <0A>dd <09>|j <0A>dd <09>d|_|j <0A>ddd<08>|_|j<12>d
<EFBFBD>|<00>d |j<15>|<00>d |j<16>|<00>d |j<17>|<00>d|j<18>|<00>d|j<19>|<01>d
<EFBFBD>|<01>|<04>|<01>g<00>|<01>g<00>||_||_||_ d
|_!dS)a6
Parameters
----------
ax : matplotlib.axes.Axes
The :class:`matplotlib.axes.Axes` instance the button
will be placed into.
label : str
Label for this text box. Accepts string.
initial : str
Initial value in the text box
color : color
The color of the box
hovercolor : color
The color of the box when the mouse is over it
label_pad : float
the distance between the label and the right side of the textbox
g<><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?cSsg|]}d|kr|<01>qS)Zkeymapr)r<><00>keyrrrr<><00>sz$TextBox.__init__.<locals>.<listcomp>g<00>?r9rd)r:r;r<rrFr=r>r?<00>key_press_eventZ resize_eventN)"r)r<00>DIST_FROM_LEFTr<00>params_to_disabler@rArB<00>_make_text_disp<73> text_disprC<00>change_observers<72>submit_observersr*ryrx<00> cursor_index<65>vlines<65>cursorr<72>r2rErFrG<00> _keypress<73>_resizerHrIrJrKrLrMrN<00>capturekeystrokes)r r*rB<00>initialrLrMZ label_padrrrr<00>s<    



zTextBox.__init__cCs|jj|jd|dd|jjd<04>S)Ng<00>?r9re)r:r;r<)r*r@r<>rA)r <00>stringrrrr<><00>szTextBox._make_text_dispcCs<>|jd|j<01>}d}|dks,|dks,|dkr8|dk}d}|<00>|<01>}|jjj<05><06>|<03><07>}|jj<08> <09>}|<05>
|<04>}|<03> d<01>|r<>|d|d<|j <0C> d<01>|j<03> |d|d|d <00>|_ |jjj<05><06>dS)
NFr<EFBFBD><00> z <20>,)rr)rr)rr)rr)r@r<>r<>r*r+r,rVr<><00> transData<74>invertedr<r<>r<>r<>)r Z widthtextZno_textZwt_disp<73>bb<62>invrrr<00> _rendercursor<6F>s 
 

  zTextBox._rendercursorcCs,|jr(x |j<01><02>D]\}}||j<03>qWdS)N)r'r<>rTr@)r r1rUrrr<00>_notify_submit_observerssz TextBox._notify_submit_observerscCs2|<00>|<01>rdS|jj|jkr dS|j<01>|j<03>dS)N)r%r,rQr*rS)r r$rrrrFs

zTextBox._releasecCs<>|<00>|<01>rdS|j<01>r<>|j}t|<02>dkr^|jd|j<05>||j|jd<00>|_|jd7_n<>|dkr<>|jt|j<04>kr<>|jd7_n<>|dkr<>|jdkr<>|jd8_n<>|dkr<>d|_n<>|dkr<>t|j<04>|_n<>|dk<02>r|jdk<03>r\|jd|jd<00>|j|jd<00>|_|jd8_nB|dk<02>r\|jt|j<04>k<03>r\|jd|j<05>|j|jdd<00>|_|j<06><07>|<00>|j<04>|_|<00> <09>|<00>
<EFBFBD>|d k<02>r<>|<00> <0B>dS)
Nrrdrer<00>home<6D>endZ backspace<63>deleteZenter) r%r<>r<>r<>r@r<>r<><00>remover<65>r<><00>_notify_change_observersr<73>)r r$r<>rrrr<>$sB
 

 


zTextBox._keypresscCsPt|<01>}|j|krdS||_|j<02><03>|<00>|j<01>|_|<00><05>|<00><06>|<00><07>dS)N)<08>strr@r<>r<>r<>r<>r<>r<>)r r^Znewvalrrrr|Is

zTextBox.set_valcCs,|jr(x |j<01><02>D]\}}||j<03>qWdS)N)r'r<>rTr@)r r1rUrrrr<>Tsz TextBox._notify_change_observerscCs6d|_i|_x$|jD]}t||j|<gt|<qWdS)NT)r<><00> reset_paramsr<73>r)r r<>r<>rrr<00> begin_typingYs
 zTextBox.begin_typingcCs\d}|jr,x|jD]}|j|t|<qWd}d|_|j<04>d<01>|jjj<08> <09>|rX|<00>
<EFBFBD>dS)NFT) r<>r<>r<>rr<>r<>r*r+r,rVr<>)r Z notifysubmitr<74>rrr<00> stop_typingbs  zTextBox.stop_typingcCs<>t|j<01>dkrd|_nz|j<03><04>}|jj}|jj<06><07>}|<03>|<04>|<02><01>}|d}|d}||||}|dkrpd}|dkr|d}t t|j<01>|<00>|_|<00>
<EFBFBD>dS)Nr)rr)rrr) r<>r@r<>r<>r<>r*r<>r<>r<<00>intr<74>)r r<>r<><00>transr<73>Z
text_startZtext_endZratiorrr<00>position_cursorss
 zTextBox.position_cursorcCsn|<00>|<01>rdS|j|jkr&|<00><03>dS|js0dS|jj|jkrL|j<05>|j<02>|js^|<00> |j
<EFBFBD>|<00> |j
<EFBFBD>dS)N) r%rPr*r<>r'r,rQrRr<>r<>r<>r<>)r r$rrrrE<00>s
  zTextBox._clickcCs |<00><00>dS)N)r<>)r r$rrrr<><00>szTextBox._resizecCs\|<00>|<01>rdS|j|jkr"|j}n|j}||jkrX|j<02>|<02>||_|jrX|jjj <09>
<EFBFBD>dS)N) r%rPr*rMrLrNrIr&r+r,rV)r r$r4rrrrG<00>s
 
 zTextBox._motioncCs"|j}||j|<|jd7_|S)z<>
When the text changes, call this *func* with event.
A connection id is returned which can be used to disconnect.
r)rCr<>)r rUr1rrr<00>on_text_change<67>s
zTextBox.on_text_changecCs"|j}||j|<|jd7_|S)z<>
When the user hits enter or leaves the submission box, call this
*func* with event.
A connection id is returned which can be used to disconnect.
r)rCr<>)r rUr1rrr<00> on_submit<69>s
zTextBox.on_submitc Cs:x4|j|jgD]$}y
||=Wqtk
r0YqXqWdS)z-Remove the observer with connection id *cid*.N)r<>r<>rX)r r1<00>regrrrrY<00>s

zTextBox.disconnectN)r<>r<>r<>r<>)rrrrrr<>r<>r<>rFr<>r|r<>r<>r<>r<>rEr<>rGr<>r<>rYrrrrr<><00>s&
D%     r<>c@s:eZdZdZddd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>ZdS)<10> RadioButtonsaI
A GUI neutral radio button.
For the buttons to remain responsive you must keep a reference to this
object.
Connect to the RadioButtons with the :meth:`on_clicked` method.
Attributes
----------
ax
The containing `~.axes.Axes` instance.
activecolor
The color of the selected button.
labels
A list of `~.text.Text` instances containing the button labels.
circles
A list of `~.patches.Circle` instances defining the buttons.
value_selected : str
The label text of the currently selected button.
r<00>bluec Cs4t<00>||<01>||_d|_|<01>g<00>|<01>g<00>|<01>d<02>dt|<02>d}t<08> d||t|<02><01>}d}|<01>
<EFBFBD>}|dd} | dkr<>d} g|_ g|_ x<>t ||<02>D]z\}
} |jd |
| |jd
d d <0C>} ||kr<>| |_|} n|} td |
f| d| |jd<0F>}|j <0B>| <0C>|j <0C>|<0E>|<01>|<0E>|d7}q<>W|<00>d|j<14>d|_i|_dS)a<>
Add radio buttons to an `~.axes.Axes`.
Parameters
----------
ax : `~matplotlib.axes.Axes`
The axes to add the buttons to.
labels : list of str
The button labels.
active : int
The index of the initially selected button.
activecolor : color
The color of the selected button.
NFg<00>?rrr<>g{<14>G<EFBFBD>z<EFBFBD>?g<><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?g<00>?rer9)r<r;r:g333333<33>?r<>)r<><00>radiusr<73>r<>r<r=)r)r<00> activecolor<6F>value_selectedrJrKrHr<>r~r<>r<>r<><00>circlesr<73>r@rArr/r<>r2r<>rCrD)r r*r<>rr<>r<>r<>rCr<>Z circle_radiusr<73>rBr<>r<>r<>rrrr<00>s@ 


     
 zRadioButtons.__init__c Cs<>|<00>|<01>s |jdks |j|jkr$dS|jj<04><05><00>|j|jf<02>}t <09>
|d|dg<02>}i}xdt t |j |j<0E><02>D]N\}\}}|<07><0F><00>|j|j<08>s<>t j<11>||j<00>|jkrlt j<11>||j<00>||<qlWt|<04>dkr<>t||jd<03>}|<00>|<08>dS)Nrr)r<>)r%r<>rPr*rAr<><00>transform_pointr<74>r<>r~<00>arrayr<79>r<>r<>r<>r<>r<>ZlinalgZnormr9r<>r<><00>min<69>getr) r r$r<>ZpclickedZ distancesr<73>r<>r<><00>closestrrrr<>s   zRadioButtons._clickedcCs<>d|krt|j<01>kr*nn td|<00><01>|j|<00><03>|_x:t|j<06>D],\}}||kr^|j}n
|j<08> <09>}|<03>
|<04>qFW|j r<>|jj j <0A><0E>|js<>dSx(|j<10><11>D]\}}||j|<00><03><00>q<>WdS)zv
Select button with number *index*.
Callbacks will be triggered if :attr:`eventson` is True.
rzInvalid RadioButton index: %dN)r<>r<>rr<>r<>r<>r<>r<>r*r<>rIr&r+r,rVr'rDrT)r r<>r<>r<>rLr1rUrrrr-s 
zRadioButtons.set_activecCs"|j}||j|<|jd7_|S)z<>
Connect the callback function *func* to button click events.
Returns a connection id, which can be used to disconnect the callback.
r)rCrD)r rUr1rrrrWGs
zRadioButtons.on_clickedcCs&y |j|=Wntk
r YnXdS)z-Remove the observer with connection id *cid*.N)rDrX)r r1rrrrYRs zRadioButtons.disconnectN)rr<>) rrrrrr<>rrWrYrrrrr<><00>s 
< r<>c@sHeZdZdZdd<03>Zdd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Z dd<0F>Z
dS)<11> SubplotToolzU
A tool to adjust the subplot params of a :class:`matplotlib.figure.Figure`.
csF|<01>_<00>jddd<03><00><02>d<04><01>_<03>j<03>d<05><00>j<03>d<06>t<06>jddd |jjdd
<EFBFBD><06>_ <09>j <09>
<EFBFBD>j <0B><00><02>d <0B><01>_ <0C>j <0C>d<06>t<06>j d dd |jj dd
<EFBFBD><06>_<0E>j<0E>
<EFBFBD>j<0F><00><02>d <0A><01>_<10>j<10>d<06>t<06>jddd |jjdd<0F><06>_<12>j<12>
<EFBFBD>j<13><00><02>d<10><01>_<14>j<14>d<06>t<06>jddd |jjdd<0F><06>_<16>j<16>
<EFBFBD>j<17><00><02>d<12><01>_<18>j<18>d<06>t<06>jddd |jjdd
<EFBFBD><06>_<1A>j<1A>
<EFBFBD>j<1B><00><02>d<14><01>_<1C>j<1C>d<06>t<06>jddd |jjdd
<EFBFBD><06>_<1E>j<1E>
<EFBFBD>j<1F><00>j<12>j _ <20>j <09>j_!<21>j<16>j_ <20>j<0E>j_!<21><02>"ddddg<04>}t#|d<1A><02>_$<24>j <09>j<0E>j<12>j<16>j<1A>jf<06><01><00><01>fdd<1C>}<04>jj%}d<06>j_%<25>j$<24>&|<04>|<05>j_%dS)a
*targetfig*
The figure instance to adjust.
*toolfig*
The figure instance to embed the subplot tool into. If
*None*, a default figure will be created. If you are using
this from the GUI
g<><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?g<><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?)rerdi<>z'Click on slider to adjust subplot paramFrerr)rki<>rbi<>rd)rji<>rci<><00>wspacei<65><00>hspaceg<65><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?g<><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?g333333<33>?g333333<33>?ZResetcs<><00>j}d<01>_g}x<1E>D]}|<02>|j<00>d|_qWx<14>D] }|<03><02>q6Wxt<03>|<02>D]\}}||_qRW|<01>_<00>jr<><72>j<04><05><00>jj<04><05>dS)NF)r&r/r<>r<>r,rV<00> targetfig)r$Z
thisdrawon<EFBFBD>bsZslider<65>b)r <00>sliders<72>toolfigrrrU<00>s
 

 

z"SubplotTool.__init__.<locals>.funcN)'r<><00>subplots_adjustZ add_subplotZaxleft<66> set_titlerHrZZ subplotparsreZ
sliderleftr<EFBFBD><00>funcleftZaxbottomrbZ sliderbottom<6F>
funcbottomZaxrightrdZ sliderright<68> funcrightZaxtoprcZ slidertop<6F>functopZaxwspacer<65>Z sliderwspace<63>
funcwspaceZaxhspacer<65>Z sliderhspace<63>
funchspacermrlZadd_axesr6Z buttonreset<65>validaterW)r r<>r<>ZbaxrUr<>r)r r<>r<>rr^sj    

  
   
   
  

  





   zSubplotTool.__init__cCs$|jj|d<01>|jr |jj<03><04>dS)N)re)r<>r<>r&r,rV)r r^rrrr<><00>szSubplotTool.funcleftcCs$|jj|d<01>|jr |jj<03><04>dS)N)rd)r<>r<>r&r,rV)r r^rrrr<><00>szSubplotTool.funcrightcCs$|jj|d<01>|jr |jj<03><04>dS)N)rb)r<>r<>r&r,rV)r r^rrrr<><00>szSubplotTool.funcbottomcCs$|jj|d<01>|jr |jj<03><04>dS)N)rc)r<>r<>r&r,rV)r r^rrrr<><00>szSubplotTool.functopcCs$|jj|d<01>|jr |jj<03><04>dS)N)r<>)r<>r<>r&r,rV)r r^rrrr<><00>szSubplotTool.funcwspacecCs$|jj|d<01>|jr |jj<03><04>dS)N)r<>)r<>r<>r&r,rV)r r^rrrr<><00>szSubplotTool.funchspaceN) rrrrrr<>r<>r<>r<>r<>r<>rrrrr<>Zsir<>c@s2eZdZdZd dd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd S)<0E>Cursora
A crosshair cursor that spans the axes and moves with mouse cursor.
For the cursor to remain responsive you must keep a reference to it.
Parameters
----------
ax : `matplotlib.axes.Axes`
The `~.axes.Axes` to attach the cursor to.
horizOn : bool, optional, default: True
Whether to draw the horizontal line.
vertOn : bool, optional, default: True
Whether to draw the vertical line.
useblit : bool, optional, default: False
Use blitting for faster drawing if supported by the backend.
Other Parameters
----------------
**lineprops
`.Line2D` properties that control the appearance of the lines.
See also `~.Axes.axhline`.
Examples
--------
See :doc:`/gallery/widgets/cursor`.
TFcKs<>t<00>||<01>|<00>d|j<03>|<00>d|j<04>d|_||_||_|oD|jj |_
|j
rVd|d<|j |<01> <0C>dfddi|<05><02>|_ |j|<01><0F>dfddi|<05><02>|_d|_d|_dS)Nr?<00>
draw_eventT<EFBFBD>animatedr<00>visibleF)r)rr2<00>onmove<76>clearr<72><00>horizOn<4F>vertOnr,<00> supports_blit<69>useblitru<00>
get_ybound<EFBFBD>linehrv<00>
get_xbound<EFBFBD>linev<65>
background<EFBFBD> needclear)r r*rrr<00> linepropsrrrrs   zCursor.__init__cCsB|<00>|<01>rdS|jr&|j<02>|jj<05>|_|j<07>d<02>|j <09>d<02>dS)z+Internal event handler to clear the cursor.NF)
r%rr,<00>copy_from_bboxr*<00>bboxrrr<>r)r r$rrrr<>s 
 z Cursor.clearcCs<>|<00>|<01>rdS|jj<02>|<00>s dS|j|jkr^|j<06>d<02>|j<08>d<02>|j rZ|j<01>
<EFBFBD>d|_ dSd|_ |j sndS|j<06> |j |j f<02>|j<08>|j|jf<02>|j<06>|j o<>|j<10>|j<08>|j o<>|j<11>|<00><12>dS)z?Internal event handler to draw the cursor when the mouse moves.NFT)r%r,<00>
widgetlockrrPr*rr<>rr rVr<><00> set_xdatar<61><00> set_ydatar<61>rrrz)r r$rrrr<>s&
   
z Cursor.onmovecCsZ|jrL|jdk r|j<02>|j<01>|j<04>|j<06>|j<04>|j<07>|j<02>|jj <09>n
|j<02>
<EFBFBD>dS)NF) rrr,<00>restore_regionr*<00> draw_artistrr<00>blitr r<>)r rrrrz8s

zCursor._updateN)TTF)rrrrrr<>r<>rzrrrrr<><00>s

 r<>c@sBeZdZdZddd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Zdd<0F>Z dS)<12> MultiCursora<72>
Provide a vertical (default) and/or horizontal line cursor shared between
multiple axes.
For the cursor to remain responsive you must keep a reference to
it.
Example usage::
from matplotlib.widgets import MultiCursor
import matplotlib.pyplot as plt
import numpy as np
fig, (ax1, ax2) = plt.subplots(nrows=2, sharex=True)
t = np.arange(0.0, 2.0, 0.01)
ax1.plot(t, np.sin(2*np.pi*t))
ax2.plot(t, np.sin(4*np.pi*t))
multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1,
horizOn=False, vertOn=True)
plt.show()
TFc  s<>||_||_||_||_|d<00><04>\}}|d<00><05>\} }
d||<00>d| |
<00>d|_|o`|jj|_d|_ d|_
|jr~d<03>d<|r<><72><00>fdd<07>|D<00>|_ ng|_ |r<><72><00>fdd<07>|D<00>|_ ng|_ |<00> <0A>dS) N<><4E><EFBFBD><EFBFBD><EFBFBD>g<00>?TFr<46>cs"g|]}|j<00>fddi<01><00><02><01>qS)r<>F)rv)r<>r*)r
<00>xmidrrr<>rsz(MultiCursor.__init__.<locals>.<listcomp>cs"g|]}|j<00>fddi<01><00><02><01>qS)r<>F)ru)r<>r*)r
<00>ymidrrr<>xs)r,<00>axesrr<00>get_xlim<69>get_ylimr<6D>rrrr r<><00>hlines<65>connect) r r,rrrrr
<00>xmin<69>xmax<61>ymin<69>ymaxr)r
rrrr\s.      zMultiCursor.__init__cCs(|j<00>d|j<02>|_|j<00>d|j<04>|_dS)zconnect eventsr?r<>N)r,r.r<><00>
_cidmotionr<EFBFBD><00>_ciddraw)r rrrrs
zMultiCursor.connectcCs |j<00>|j<02>|j<00>|j<03>dS)zdisconnect eventsN)r,r3r r!)r rrrrY<00>szMultiCursor.disconnectcCsL|<00>|<01>rdS|jr(|j<02>|jjj<05>|_x|j|jD]}|<02> d<02>q6WdS)zclear the cursorNF)
r%rr,r r+r rr<>rr<>)r r$<00>linerrrr<><00>s 
zMultiCursor.clearcCs<>|<00>|<01>rdS|jdkrdS|jj<03>|<00>s.dSd|_|js>dS|jrrx,|jD]"}|<02> |j
|j
f<02>|<02> |j<06>qLW|j r<>x,|j D]"}|<02>|j|jf<02>|<02> |j<06>q<>W|<00><10>dS)NT)r%rPr,r rr r<>rr<>rr<>r<>rrrr<>rz)r r$r"rrrr<><00>s$

  zMultiCursor.onmovecCs<>|jr<>|jdk r|j<02>|j<01>|jrJx$t|j|j<07>D]\}}|<01>|<02>q4W|j rvx$t|j|j
<EFBFBD>D]\}}|<01>|<02>q`W|j<02> |jj j <0A>n
|j<02><0E>dS)N)rrr,rrr<>rr<>rrrrr+r r<>)r r*r"rrrrz<00>s
zMultiCursor._updateN)TFT)
rrrrrrrYr<>r<>rzrrrrrDs
#
rc@s<>eZdZd-dd<04>Zdd<06>Zdd<08>Zd d
<EFBFBD>Zd d <0C>Zd d<0E>Zdd<10>Z dd<12>Z
dd<14>Z dd<16>Z dd<18>Z dd<1A>Zdd<1C>Zdd<1E>Zdd <20>Zd!d"<22>Zd#d$<24>Zd%d&<26>Zd'd(<28>Zd)d*<2A>Zd+d,<2C>ZdS).<2E>_SelectorWidgetFNcCs<>t<00>||<01>d|_||_|o"|jj|_|<00><07>tddddd<06>|_ |j <09>
|pLi<00>d|_ g|_ t |t<0E>rp|g|_n||_d|_d|_d|_t<13>|_dS)NTr<54><00>escape<70>shift<66>control)<04>mover<65><00>squarer9)r)rr<><00>onselectr,rr<00>connect_default_events<74>dict<63>state_modifier_keys<79>updater<00>artists<74>
isinstancer<00> validButtons<6E>
eventpress<EFBFBD> eventrelease<73> _prev_event<6E>set<65>state)r r*r)rr<>r,rrrr<00>s"  

z_SelectorWidget.__init__cCst<00>||<01>|r|<00>d<00>dS)N)r)r<00>update_background)r rrrrr<00>s z_SelectorWidget.set_activecCs|jr|j<01>|jj<04>|_dS)z!force an update of the backgroundN)rr,r r*r r)r r$rrrr6<00>sz!_SelectorWidget.update_backgroundcCsf|<00>d|j<01>|<00>d|j<02>|<00>d|j<03>|<00>d|j<04>|<00>d|j<05>|<00>d|j<06>|<00>d|j<07>dS) z+Connect the major canvas events to methods.r?r=r>r<>r<>Zkey_release_eventZ scroll_eventN)r2r<><00>pressrr6<00> on_key_press<73>on_key_release<73> on_scroll)r rrrr*<00>sz&_SelectorWidget.connect_default_eventscCs<>|jr|j<01><02>sdS|jj<04>|<00>s&dSt|d<02>s6d|_|jdk rP|j|jkrPdS|j dkrf|j
|jkS|j|j jkrxdS|j
|jkp<>|j|j jkS)z*return *True* if *event* should be ignoredTr<54>NF) rr*r<>r,r rrfr<>r0r1rP)r r$rrrr%<00>s

 
  z_SelectorWidget.ignorecCsh|j<00><01>sdS|jrZ|jdk r,|j<04>|j<03>x|jD]}|j<00>|<01>q4W|j<04>|jj <09>n
|j<04>
<EFBFBD>dS)zTdraw using newfangled blit or oldfangled draw depending on
useblit
FN) r*r<>rrr,rr.rrr r<>)r <00>artistrrrr- s

 
z_SelectorWidget.updatecCs^|jdkrdS|j<01><02>\}}|j<01><03>\}}t||j<00>}t||<06>}t||j<06>}t||<07>}||fS)z.Get the xdata and ydata for event, with limitsN)NN)r<>r*rr<00>maxr<78>r<>)r r$<00>x0<78>x1<78>y0<79>y1r<31>r<>rrr<00> _get_data s
 
 
z_SelectorWidget._get_datacCs8|jdkr|j}n
t<02>|<01>}|<00>|<01>\|_|_||_|S)z<>Clean up an event
Use prev event if there is no xdata
Limit the xdata and ydata to the axes limits
Set the prev event
N)r<>r3<00>copyrAr<>)r r$rrr<00> _clean_event,s 

z_SelectorWidget._clean_eventcCsb|<00>|<01>s^|<00>|<01>}||_||_|jp(d}|<02>dd<03>}||jdkrP|j<07>d<04>|<00> |<01>dSdS)z"Button press handler and validatorr<72><00>ctrlr&r'TF)
r%rCr1r3r<><00>replacer,r5<00>add<64>_press)r r$r<>rrrr7<s


  
z_SelectorWidget.presscCsdS)zButton press handlerNr)r r$rrrrGKsz_SelectorWidget._presscCsJ|<00>|<01>sF|jrF|<00>|<01>}||_|<00>|<01>d|_d|_|j<05>d<02>dSdS)z*Button release event handler and validatorNr'TF)r%r1rCr2rFr5<00>discard)r r$rrrrOs

 z_SelectorWidget.releasecCsdS)zButton release event handlerNr)r r$rrrrF[sz_SelectorWidget._releasecCs,|<00>|<01>s(|jr(|<00>|<01>}|<00>|<01>dSdS)z'Cursor move event handler and validatorTF)r%r1rC<00>_onmove)r r$rrrr<>_s


z_SelectorWidget.onmovecCsdS)zCursor move event handlerNr)r r$rrrrIgsz_SelectorWidget._onmovecCs|<00>|<01>s|<00>|<01>dS)z(Mouse scroll event handler and validatorN)r%<00>
_on_scroll)r r$rrrr:ks
z_SelectorWidget.on_scrollcCsdS)zMouse scroll event handlerNr)r r$rrrrJpsz_SelectorWidget._on_scrollcCs<>|jr<>|jpd}|<02>dd<03>}||jdkrPx|jD]}|<03>d<05>q2W|<00><06>dSx*|j<03><07>D]\}}||kr\|j<08> |<04>q\W|<00>
|<01>dS)z?Key press event handler and validator for all selection widgetsr<73>rDr&r<>FN) rr<>rEr,r.r<>r-rTr5rF<00> _on_key_press)r r$r<>r;r5<00>modifierrrrr8ts
  z_SelectorWidget.on_key_presscCsdS)zMKey press event handler - use for widget-specific key press actions.
Nr)r r$rrrrK<00>sz_SelectorWidget._on_key_presscCsJ|jrF|jpd}x*|j<02><03>D]\}}||kr|j<04>|<03>qW|<00>|<01>dS)z(Key release event handler and validator.r<>N)rr<>r,rTr5rH<00>_on_key_release)r r$r<>r5rLrrrr9<00>s 
z_SelectorWidget.on_key_releasecCsdS)zKey release event handler.Nr)r r$rrrrM<00>sz_SelectorWidget._on_key_releasecCs$||_x|jD]}|<02>|<01>qWdS)z"Set the visibility of our artists.N)r<>r.r<>)r r<>r;rrrr<><00>s z_SelectorWidget.set_visible)FNN)rrrrrr6r*r%r-rArCr7rGrrFr<>rIr:rJr8rKr9rMr<>rrrrr#<00>s,

!   r#c@s`eZdZdZddd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Ze <09>
d<0E>e dd<10><00><01>Z dd<12>Z dd<14>ZdS)<16> SpanSelectora(
Visually select a min/max range on a single axis and call a function with
those values.
To guarantee that the selector remains responsive, keep a reference to it.
In order to turn off the SpanSelector, set `span_selector.active=False`. To
turn it back on, set `span_selector.active=True`.
Parameters
----------
ax : :class:`matplotlib.axes.Axes` object
onselect : func(min, max), min/max are floats
direction : "horizontal" or "vertical"
The axis along which to draw the span selector
minspan : float, default is None
If selection is less than *minspan*, do not call *onselect*
useblit : bool, default is False
If True, use the backend-dependent blitting features for faster
canvas updates.
rectprops : dict, default is None
Dictionary of :class:`matplotlib.patches.Patch` properties
onmove_callback : func(min, max), min/max are floats, default is None
Called on mouse move while the span is being selected
span_stays : bool, default is False
If True, the span stays visible after the mouse is released
button : int or list of ints
Determines which mouse buttons activate the span selector
1 = left mouse button
2 = center mouse button (scroll wheel)
3 = right mouse button
Examples
--------
>>> import matplotlib.pyplot as plt
>>> import matplotlib.widgets as mwidgets
>>> fig, ax = plt.subplots()
>>> ax.plot([1, 2, 3], [10, 50, 100])
>>> def onselect(vmin, vmax):
... print(vmin, vmax)
>>> rectprops = dict(facecolor='blue', alpha=0.5)
>>> span = mwidgets.SpanSelector(ax, onselect, 'horizontal',
... rectprops=rectprops)
>>> fig.show()
See also: :doc:`/gallery/widgets/span_selector`
NFc
Cs<>tj||||| d<01>|dkr(tddd<04>}|j|d<tjddg|d<08>||_d|_d|_||_ ||_
||_ ||_ d |_ d|_|<00>|<01>dS)
N)rr<><00>redg<00>?)r<><00>alphar<61>r]r_)<01> direction)rr)r#rr+rr<00>_check_in_listrQ<00>rect<63>pressv<73> rectprops<70>onmove_callback<63>minspan<61>
span_stays<EFBFBD>prevr,<00>new_axes)
r r*r)rQrWrrUrVrXr<>rrrr<00>s   
zSpanSelector.__init__cCs<>||_|j|jjk r8|jdk r&|<00><03>|jj|_|<00><04>|jdkr^t|jj|jj<08>}d\}}nt|jj|jj<07>}d\}}t d||f|dd<07>|j
<EFBFBD><02>|_ |j r<>t d||f|dd<07>|j
<EFBFBD><02>|_ |j <0A>d<06>|j<00>|j <0A>|j<00>|j <0B>|j g|_dS)z)Set SpanSelector to operate on a new AxesNr])rr)rr)rrF)r<r<>)r*r,r+r5r*rQr
r<>rArrUrSrX<00> stay_rect<63> set_animatedr<64>r.)r r*r<>r<>r<>rrrrZ<00>s4






 
  zSpanSelector.new_axescCst<00>||<01>p|j S)z*return *True* if *event* should be ignored)r#r%r<>)r r$rrrr%szSpanSelector.ignorecCsd|j<00>|j<02>|jr0|j<04>d<01>|jr0|j<06><07>|<00>|<01>\}}|j dkrP||_
n||_
|<00> |<01>dS)zon button press eventFr]) rSr<>r<>rXr[rr,rVrArQrT<00> _set_span_xy)r r$r<>r<>rrrrGs 


zSpanSelector._presscCs|jdkrdS|j<01>d<02>|jrt|j<04>|j<01><06><00>|j<04>|j<01><08><00>|j<04> |j<01>
<EFBFBD><00>|j<04> |j<01> <0C><00>|j<04>d<03>|j <0A><0E>|j}|<00>|<01>\}}|jdkr<>|p<>|jd}n|p<>|jd}||kr<>||}}||}|jdk r<>||jkr<>dS|<00>||<05>d|_dS)zon button release eventNFTr]rr)rTrSr<>rXr[<00>set_x<5F>get_x<5F>set_y<5F>get_y<5F> set_width<74> get_width<74>
set_height<EFBFBD>
get_heightr,r<>rArQrYrWr))r r$<00>vminr<6E>r<><00>vmax<61>spanrrrrF*s.
  


 zSpanSelector._releasez3.1cCsdS)NFr)r rrr<00>
buttonDownIszSpanSelector.buttonDowncCs<>|jdkrdS|<00>|<01>|jdk r||j}|<00>|<01>\}}|jdkrP|pL|jd}n|p\|jd}||krp||}}|<00>||<05>|<00><06>dS)zon motion notify eventNr]rrF)rTr]rVrArQrYr-)r r$rfr<>r<>rgrrrrINs




 zSpanSelector._onmovecCs<>|<00>|<01>\}}|dkrdS||f|_|jdkr4|}n|}||j}}||krV||}}|jdkr~|j<04>|<05>|j<04>||<00>n|j<04>|<05>|j<04>||<00>dS)zSetting the span coordinatesNr]) rArYrQrTrSr^rbr`rd)r r$r<>r<><00>vZminvZmaxvrrrr]ds

 

  zSpanSelector._set_span_xy)NFNNFN)rrrrrrZr%rGrFr<00>
deprecatedr(rirIr]rrrrrN<00>s8
!rNc@sTeZdZdZddd<06>Zedd<08><00>Zed d
<EFBFBD><00>Zdd d <0C>Zd d<0E>Z dd<10>Z
dd<12>Z dS)<15> ToolHandlesa<73>Control handles for canvas tools.
Parameters
----------
ax : :class:`matplotlib.axes.Axes`
Matplotlib axes where tool handles are displayed.
x, y : 1D arrays
Coordinates of control handles.
marker : str
Shape of marker used to display handle. See `matplotlib.pyplot.plot`.
marker_props : dict
Additional marker properties. See :class:`matplotlib.lines.Line2D`.
rNTc Csd||_t|ddddddd<07>}|<07>|dk r,|ni<00>t||fd|i|<07><02>|_|j<00>|j<04>|j|_dS) N<>r<><00>noneg<00>?FZ
_nolegend_)<07>markerZ
markersize<EFBFBD>mfcZlsrPr<>rBr<>)r*r+r-r<00>_markersr<73>r;)r r*r<>r<>ro<00> marker_propsr<00>propsrrrr<00>s
 zToolHandles.__init__cCs
|j<00><01>S)N)rqZ get_xdata)r rrrr<><00>sz ToolHandles.xcCs
|j<00><01>S)N)rqZ get_ydata)r rrrr<><00>sz ToolHandles.ycCs*|dk r|}t<00>||g<02>}|j<02>|<01>dS)z Set x and y positions of handlesN)r~r<>rq<00>set_data)r <00>ptsr<73>r<>rrrrt<00>szToolHandles.set_datacCs|j<00>|<01>dS)N)rqr<>)r r^rrrr<><00>szToolHandles.set_visiblecCs|j<00>|<01>dS)N)rqr\)r r^rrrr\<00>szToolHandles.set_animatedcCs~t<00>|j|jf<02>}|jj<05>|<03>}|||f}|jdkrbt<00>tj |ddd<03><02>}t<00>
|<05>t<00> |<05>fSdt<00>t<00> |d<00><01>fSdS)z1Return index and pixel distance to closest index.r<>r)ZaxisrN) r~Z transposer<65>r<>r*r<>r<<00>ndim<69>sqrt<72>sumZargminr<6E>)r r<>r<>ruZdiff<66>distrrrr<><00>s 
zToolHandles.closest)rNT)N) rrrrrr(r<>r<>rtr<>r\r<>rrrrrl{s 
 
rlc @s<>eZdZdZeZd dd<08>Zd d
<EFBFBD>Zd d <0C>Zd d<0E>Z e
dd<10><00>Z e
dd<12><00>Z e
dd<14><00>Z e
dd<16><00>Ze
dd<18><00>Zejdd<18><00>Zdd<1B>Zdd<1D>Ze
dd<1F><00>ZdS)!<21>RectangleSelectora
Select a rectangular region of an axes.
For the cursor to remain responsive you must keep a reference to
it.
Example usage::
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import RectangleSelector
def onselect(eclick, erelease):
"eclick and erelease are matplotlib events at press and release."
print('startposition: (%f, %f)' % (eclick.xdata, eclick.ydata))
print('endposition : (%f, %f)' % (erelease.xdata, erelease.ydata))
print('used button : ', eclick.button)
def toggle_selector(event):
print('Key pressed.')
if event.key in ['Q', 'q'] and toggle_selector.RS.active:
print('RectangleSelector deactivated.')
toggle_selector.RS.set_active(False)
if event.key in ['A', 'a'] and not toggle_selector.RS.active:
print('RectangleSelector activated.')
toggle_selector.RS.set_active(True)
x = np.arange(100.) / 99
y = np.sin(x)
fig, ax = plt.subplots()
ax.plot(x, y)
toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='line')
fig.canvas.mpl_connect('key_press_event', toggle_selector)
plt.show()
<20>boxNF<4E>data<74>
cCstj|||||
|d<01>d|_d|_| |_|dkr:d}d|_|dkr<>|dkrZtdd d
dd <0B>}|j|d <||_|jd&ddi|j<07><02>|_|j <09>
|j<02>|dkr<>|dkr<>td dddd<14>}|j|d <||_ t ddgddgfddi|j <0B><02>|_|j <09> |j<02>||_||_tjddg| d<17>| |_||_| |_|dk<08>r6tdd<19>}nt|<08>dd<18>d<19>}ddddg|_|j\}}t|j ||||jd<1F>|_d d!d"d#g|_|j\}}t|j ||d$||jd%<25>|_|j\}}t|j |g|gd$||jd%<25>|_d|_|j|jj |jj |jj g|_!|j<04>s|jg|_!d|_"dS)'a<>
Create a selector in *ax*. When a selection is made, clear
the span and call onselect with::
onselect(pos_1, pos_2)
and clear the drawn box/line. The ``pos_1`` and ``pos_2`` are
arrays of length 2 containing the x- and y-coordinate.
If *minspanx* is not *None* then events smaller than *minspanx*
in x direction are ignored (it's the same for y).
The rectangle is drawn with *rectprops*; default::
rectprops = dict(facecolor='red', edgecolor = 'black',
alpha=0.2, fill=True)
The line is drawn with *lineprops*; default::
lineprops = dict(color='black', linestyle='-',
linewidth = 2, alpha=0.5)
Use *drawtype* if you want the mouse to draw a line,
a box or nothing between click and actual position by setting
``drawtype = 'line'``, ``drawtype='box'`` or ``drawtype = 'none'``.
Drawing a line would result in a line from vertex A to vertex C in
a rectangle ABCD.
*spancoords* is one of 'data' or 'pixels'. If 'data', *minspanx*
and *minspanx* will be interpreted in the same coordinates as
the x and y axis. If 'pixels', they are in pixels.
*button* is a list of integers indicating which mouse buttons should
be used for rectangle selection. You can also specify a single
integer if only a single button is desired. Default is *None*,
which does not limit which button can be used.
Note, typically:
1 = left mouse button
2 = center mouse button (scroll wheel)
3 = right mouse button
*interactive* will draw a set of handles and allow you interact
with the widget after it is drawn.
*state_modifier_keys* are keyboard modifiers that affect the behavior
of the widget.
The defaults are:
dict(move=' ', clear='escape', square='shift', center='ctrl')
Keyboard modifiers, which:
'move': Move the existing shape.
'clear': Clear the current shape.
'square': Makes the shape square.
'center': Make the initial point the center of the shape.
'square' and 'center' can be combined.
)rr<>r,NTrnr"Fr{rOr<>g<><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?)r<>r<>rP<00>fillr<6C><00>rrrrr<><00>-r<>g<00>?)rL<00> linestyler<65>rPr|<00>pixels)<01>
spancoordsr`)<01>mecr<63><00>NW<4E>NEZSE<53>SW)rrr<00>W<>N<>E<>S<>s)rorrr)rrr)#r#r<00>to_drawr<77><00> interactiver+rrU<00> _shape_klassr*r<>r
rr<><00>minspanx<6E>minspanyrrRr<><00>drawtype<70>maxdistr<74><00> _corner_order<65>cornersrl<00>_corner_handles<65> _edge_order<65> edge_centers<72> _edge_handlesr9<00>_center_handle<6C> active_handler;r.<00>_extents_on_press)r r*r)r<>r<>r<>rr
rUr<>r<>r<>rrr<>r,rs<00>xc<78>yc<79>xe<78>yerrrr<00>spA 

  

 
 
  
  
 
 
zRectangleSelector.__init__cCsj|jr|j<01><02>r|<00>|<01>nd|_|jdks2|js:|<00><05>|jsZ|j}|j}||||f|_|<00> |j
<EFBFBD>dS)zon button press eventN) r<>r<>r<><00>_set_active_handler<65>r-r<>r<><00>extentsr<73>r<>)r r$r<>r<>rrrrGfs zRectangleSelector._presscCs<>|js|j<01>d<01>|j\}}}}||j_||j_|jj<08> ||g<02>}|\|j_
|j_ ||j _||j _|jj<08> ||g<02>}|\|j _
|j _ |j dkr<>|jj|jj}} |j j|j j}
} nD|j dkr<>|jj
|jj }} |j j
|j j }
} ntjddg|j d<04>||
k<04>r |
|}}
| | k<04>r | | } } |
|} | | } |jdk <09>oD| |jk}|jdk <09>oZ| |jk}|jdk<03>r<>|<0E>st|<0F>r<>x|jD]}|<10>d<01><00>q|W|<00><14>dS|<00>|j|j <0C>|<00><14>dS)zon button release eventFr|r<>)r<>Nrn)r<>r<>r<>r<>r1r<>r<>r*r<>r<>r<>r<>r2r<>rrRr<>r<>r<>r.r-r))r r$r><00>x2r@<00>y2Zxy1Zxy2rrrrZspanxZspanyZ xproblemsZ yproblemsr;rrrrFzsF 







 zRectangleSelector._releasec Cs|jrV|jdksV|j\}}}}|jddg|jkr8|j}|jddg|jkrR|j}<05>n<>d|jksj|jdkr<>|jdk r<>|j\}}}}|j|jj}|j|jj}||7}||7}||7}||7}<05>nF|jj|jjg}|jj|jjg} |j|dd }|j|d
d }d |jk<06>r<>t |j| d<00>}
t |j| d
<00>} |
<EFBFBD>s@dSt
t |
<EFBFBD>t | <0B><01>} t |
<EFBFBD>| k<00>rt|| t |
<EFBFBD>d 9}t | <0B>| k<00>r<>|| t | <0B>d 9}d |jk<06>r<>|d9}|d9}n |d|7<|d
|7<|d||d||d
||d
|f\}}}}||||f|_ dS)z,on motion notify event if box/line is wanted<65>Cr<43>r<>r<>r<>r'Nrg@rr(g<><67><EFBFBD><EFBFBD><EFBFBD>ư>r9r<>) r<>r<>r<>r<>r<>r5r1r<>r<><00>absr<r<>) r r$r>r<>r@r<><00>dxr<78>r9Z
center_pixZdx_pixZdy_pixZmaxdrrrrI<00>sJ

   
 zRectangleSelector._onmovec Cs<>|jdkr>|j<01><02>}|j<01><03>}|j<01><04>}|j<01><05>}||||fS|j<01><06>\}}t|<05>t|<05>}}t|<06>t|<06>}}||||||fSdS)Nr{) r<>r<>r_rarcre<00>get_datar<61>r<) r r=r?r<>r<>r<>r<>r>r@rrr<00>
_rect_bbox<EFBFBD>s




 zRectangleSelector._rect_bboxcCs>|j\}}}}||||||f}||||||f}||fS)z7Corners of rectangle from lower left, moving clockwise.)r<>)r r=r?r<>r<>r<>r<>rrrr<><00>szRectangleSelector.cornersc CsV|j\}}}}|d}|d}|||||||f}|||||||f}||fS)z8Midpoint of rectangle edges from left, moving clockwise.g@)r<>) r r=r?r<>r<>r<>r<>r<>r<>rrrr<><00>s zRectangleSelector.edge_centerscCs&|j\}}}}||d||dfS)zCenter of rectangleg@)r<>)r r=r?r<>r<>rrrr9 szRectangleSelector.centerc CsB|j\}}}}t|||g<02>\}}t|||g<02>\}}||||fS)z Return (xmin, xmax, ymin, ymax).)r<><00>sorted) r r=r?r<>r<>rrrrrrrr<> szRectangleSelector.extentscCsL|<00>|<01>|jj|j<03>|jj|j<05>|jj|j<07>|<00>|j <09>|<00>
<EFBFBD>dS)N) <0B>
draw_shaper<EFBFBD>rtr<>r<>r<>r<>r9r<>r<>r-)r r<>rrrr<> s 
 c Cs<>|\}}}}t||g<02>\}}t||g<02>\}} t|j<01><02><00>}
t|j<01><03><00>} t|
d|<06>}t| d|<08>}t||
d<00>}t| | d<00>} |jdkr<>|j<07>|<06>|j<07> |<08>|j<07>
||<00>|j<07> | |<00>n |jdkr<>|j<07> ||g|| g<02>dS)Nrrr{r") r<>r*rrr<r<>r<>r<>r^r`rbrdrt) r r<>r=r>r?r@rrrrZxlimZylimrrrr<> s  
  
zRectangleSelector.draw_shapec Cs<>|j<00>|j|j<03>\}}|j<04>|j|j<03>\}}|j<05>|j|j<03>\}}d|jkr\d|_|j|_ nV||j
dkrrd|_n@||j
kr<>||j
kr<>d|_dS||kr<>|j ||_n |j ||_|j\}} }
} |jdkr<>| |j }} |jdkr<>| |j}
} || |
| f|_ dS)z:Set active handle based on the location of the mouse eventr'r<>r<>N)r<>r<>r<>)r<>r<>r<>)r<>r<>r<>r<>r<>r<>r5r<>r<>r<>r<>r<>r<>r<>r<>) r r$Zc_idxZc_distZe_idxZe_distZm_idxZm_distr>r<>r@r<>rrrr<>3 s(

 
 
 z$RectangleSelector._set_active_handlecCsPt|jd<01>r<|jj<03><04>}|<01>|j<01><06><00>j\}}t<08> ||g<02>St<08> |j<01>
<EFBFBD><00>SdS)a
Returns numpy.ndarray of shape (2,5) containing
x (``RectangleSelector.geometry[1,:]``) and
y (``RectangleSelector.geometry[0,:]``)
coordinates of the four corners of the rectangle starting
and ending in the top left corner.
<20> get_vertsN) rfr<>r*r<>r<>r<r<><00>Tr~r<>r<>)r Zxfmr<6D>r<>rrr<00>geometryR s
 zRectangleSelector.geometry) r{NNFNNr|Nr}NFN)rrrrrr<>rrGrFrIr(r<>r<>r<>r9r<><00>setterr<72>r<>r<>rrrrrz<00>s($
47  
  rzc@s(eZdZdZeZdd<03>Zedd<05><00>ZdS)<07>EllipseSelectora
Select an elliptical region of an axes.
For the cursor to remain responsive you must keep a reference to
it.
Example usage::
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import EllipseSelector
def onselect(eclick, erelease):
"eclick and erelease are matplotlib events at press and release."
print('startposition: (%f, %f)' % (eclick.xdata, eclick.ydata))
print('endposition : (%f, %f)' % (erelease.xdata, erelease.ydata))
print('used button : ', eclick.button)
def toggle_selector(event):
print(' Key pressed.')
if event.key in ['Q', 'q'] and toggle_selector.ES.active:
print('EllipseSelector deactivated.')
toggle_selector.RS.set_active(False)
if event.key in ['A', 'a'] and not toggle_selector.ES.active:
print('EllipseSelector activated.')
toggle_selector.ES.set_active(True)
x = np.arange(100.) / 99
y = np.sin(x)
fig, ax = plt.subplots()
ax.plot(x, y)
toggle_selector.ES = EllipseSelector(ax, onselect, drawtype='line')
fig.canvas.mpl_connect('key_press_event', toggle_selector)
plt.show()
cCs<>|\}}}}t||g<02>\}}t||g<02>\}} |||d|||dg}
||d} | |d} |jdkr<>|
|j_d| |j_d| |j_nNt<06>t<06>d<04>d<00>} | t<06> | <0A>|
d}| t<06>
| <0A>|
d}|j<02> ||<0F>dS)Ng@r{r<><00><00> rr) r<>r<>r<>r9r<>r<>r~Zdeg2radZarange<67>cos<6F>sinrt)r r<>r>r<>r@r<>rrrrr9<00>ar<61>Zradr<64>r<>rrrr<><00> s    
 zEllipseSelector.draw_shapec Cs<>|jdkrB|jj\}}|jj}|jj}||d||d||fS|j<01><05>\}}t|<01>t|<01>}}t|<02>t|<02>}}||||||fSdS)Nr{g@)r<>r<>r9r<>r<>r<>r<>r<) r r<>r<>r<>r<>r=r>r?r@rrrr<><00> s
 zEllipseSelector._rect_bboxN) rrrrr r<>r<>r(r<>rrrrr<>c s$r<>c@sBeZdZdZddd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Zdd<0F>Z dS)<11> LassoSelectora 
Selection curve of an arbitrary shape.
For the selector to remain responsive you must keep a reference to it.
The selected path can be used in conjunction with `~.Path.contains_point`
to select data points from an image.
In contrast to `Lasso`, `LassoSelector` is written with an interface
similar to `RectangleSelector` and `SpanSelector`, and will continue to
interact with the axes until disconnected.
Example usage::
ax = subplot(111)
ax.plot(x,y)
def onselect(verts):
print(verts)
lasso = LassoSelector(ax, onselect)
Parameters
----------
ax : :class:`~matplotlib.axes.Axes`
The parent axes for the widget.
onselect : function
Whenever the lasso is released, the *onselect* function is called and
passed the vertices of the selected path.
button : List[Int], optional
A list of integers indicating which mouse buttons should be used for
rectangle selection. You can also specify a single integer if only a
single button is desired. Default is ``None``, which does not limit
which button can be used.
Note, typically:
- 1 = left mouse button
- 2 = center mouse button (scroll wheel)
- 3 = right mouse button
NTcCsltj|||||d<01>d|_|dkr(t<03>}|r4d|d<tggf|<04>|_|j<05>d<04>|j<07>|j<05>|jg|_ dS)N)rr<>Tr<54>F)
r#r<00>vertsr+rr"r<>r*r<>r.)r r*r)rr
r<>rrrr<00> s  zLassoSelector.__init__cCs|<00>|<01>dS)N)r7)r r$rrr<00>onpress<73> szLassoSelector.onpresscCs|<00>|<01>g|_|j<02>d<01>dS)NT)rAr<>r"r<>)r r$rrrrG<00> szLassoSelector._presscCs|<00>|<01>dS)N)r)r r$rrr<00> onrelease<73> szLassoSelector.onreleasecCsN|jdk r(|j<00>|<00>|<01><01>|<00>|j<00>|j<04>ggg<02>|j<04>d<01>d|_dS)NF)r<>r/rAr)r"rtr<>)r r$rrrrF<00> s 
  zLassoSelector._releasecCsB|jdkrdS|j<00>|<00>|<01><01>|j<03>tt|j<00><00><01>|<00><07>dS)N)r<>r/rAr"rt<00>listr<74>r-)r r$rrrrI<00> s

zLassoSelector._onmove)NTNN)
rrrrrr<>rGr<>rFrIrrrrr<><00> s)
r<>c@s^eZdZdZddd<06>Zdd<08>Zd d
<EFBFBD>Zd d <0C>Zd d<0E>Zdd<10>Z dd<12>Z
dd<14>Z e dd<16><00>Z dS)<18>PolygonSelectoraqSelect a polygon region of an axes.
Place vertices with each mouse click, and make the selection by completing
the polygon (clicking on the first vertex). Hold the *ctrl* key and click
and drag a vertex to reposition it (the *ctrl* key is not necessary if the
polygon has already been completed). Hold the *shift* key and click and
drag anywhere in the axes to move all vertices. Press the *esc* key to
start a new polygon.
For the selector to remain responsive you must keep a reference to
it.
Parameters
----------
ax : :class:`~matplotlib.axes.Axes`
The parent axes for the widget.
onselect : function
When a polygon is completed or modified after completion,
the `onselect` function is called and passed a list of the vertices as
``(xdata, ydata)`` tuples.
useblit : bool, optional
lineprops : dict, optional
The line for the sides of the polygon is drawn with the properties
given by `lineprops`. The default is ``dict(color='k', linestyle='-',
linewidth=2, alpha=0.5)``.
markerprops : dict, optional
The markers for the vertices of the polygon are drawn with the
properties given by `markerprops`. The default is ``dict(marker='o',
markersize=7, mec='k', mfc='k', alpha=0.5)``.
vertex_select_radius : float, optional
A vertex is selected (to complete the polygon or to move a vertex)
if the mouse click is within `vertex_select_radius` pixels of the
vertex. The default radius is 15 pixels.
Examples
--------
:doc:`/gallery/widgets/polygon_selector_demo`
FN<46>cCs<>tddddddd<05>}tj|||||d<06>dgdg|_|_d|_|dkrXtd d
d d d <0A>}|j|d<t|j|jf|<04>|_|j <09>
|j<08>|dkr<>td |<04> dd <09>d<10>}t |j |j|j|j|d<11>|_ d|_||_|j|j jg|_|<00>d<13>dS)Nr$r&r%znot-applicable)r<><00> move_vertex<65>move_allr'r(r9)rr,rFr<46>r<>r<>g<00>?)rLr<>r<>rPr<>rL)r<>rp)rrrrT)r+r#r<00>_xs<78>_ys<79>_polygon_completedrrr"r*r<>r<>rl<00>_polygon_handles<65>_active_handle_idx<64>vertex_select_radiusr;r.r<>)r r*r)rr
Z markerpropsr<73>r,rrrr)
s, 

zPolygonSelector.__init__cCsj|jsd|jkrDt|j<03>dkrD|j<04>|j|j<07>\}}||jkrD||_ |jdd<03>|j
dd<03>|_ |_ dS)zButton press event handlerr<72>rN) r<>r5r<>r<>r<>r<>r<>r<>r<>r<>r<><00> _xs_at_press<73> _ys_at_press)r r$Zh_idxZh_distrrrrGL
s 
zPolygonSelector._presscCs<>|jdkrd|_nxt|j<02>dkrP|jd|jdkrP|jd|jdkrPd|_n:|js<>d|jkr<>d|jkr<>|j<02>d|j<07>|j<03>d|j<08>|jr<>|<00> |j
<EFBFBD>dS)zButton release event handlerrrr<>Tr<54>r<>N) r<>r<>r<>r<>r<>r5<00>insertr<74>r<>r)r<>)r r$rrrrFX
s


zPolygonSelector._releasecCs&|<00>|<01>s"|<00>|<01>}|<00>|<01>dSdS)z'Cursor move event handler and validatorTF)r%rCrI)r r$rrrr<>n
s



zPolygonSelector.onmovec Cs<>|jdkrV|j}|j|j|j|<|j|<|dkrR|jrR|j|j|jd<|jd<<00>n"d|jkr<>|jr<>|j|jj}|j|jj}x<>tt |j<03><01>D],}|j
|||j|<|j |||j|<q<>Wn<>|js<>d|jks<>d|jkr<>dS|j <0C> <0A><00>|jd|jdf<02>\}}t<0F>||j||j<00>}t |j<03>dk<04>r^||jk<00>r^|jd|jd|jd<|jd<n|j|j|jd<|jd<|<00><14>dS)zCursor move event handlerrrr<>r<>Nr<4E>)r<>r<>r<>r<>r<>r<>r5r1<00>ranger<65>r<>r<>r"Z get_transformr<r~<00>hypotr<74>r<>r<><00> _draw_polygon) r r$<00>idxr<78>r<>r<>r=r?Zv0_distrrrrIz
s*
$zPolygonSelector._onmovecCsH|jsDd|jksd|jkrD|jdd<04>|jdd<04>|_|_|<00><04>dS)zKey press event handlerr<72>r<>Nr)r<>r5r<>r<>r<>)r r$rrrrK<00>
s"zPolygonSelector._on_key_presscCs<>|jsP|j|j<02>d<01>ks*|j|j<02>d<02>krP|j<04>|j<06>|j<07>|j<08>|<00> <09>nB|j|j<02>d<03>kr<>|<00>
|<01>}|jg|jg|_|_d|_|<00> d<05>dS)zKey release event handlerr<72>r<>r<>FTN) r<>r<>r,r<>r<>r/r<>r<>r<>r<>rCr<>)r r$rrrrM<00>
s

zPolygonSelector._on_key_releasecCs<>|j<00>|j|j<03>|jsNt|j<02>dkrr|jd|jdkrr|jd|jdkrr|j<06>|jdd<02>|jdd<02><00>n|j<06>|j|j<03>|<00><07>dS)z5Redraw the polygon based on the new vertex positions.r<>rrN)r"rtr<>r<>r<>r<>r<>r-)r rrrr<><00>
s$zPolygonSelector._draw_polygoncCs"tt|jdd<02>|jdd<02><00><02>S)z<>Get the polygon vertices.
Returns
-------
list
A list of the vertices of the polygon as ``(xdata, ydata)`` tuples.
Nr)r<>r<>r<>r<>)r rrrr<><00>
s zPolygonSelector.verts)FNNr<4E>)rrrrrrGrFr<>rIrKrMr<>r(r<>rrrrr<>
s&
"  & r<>c@s*eZdZdZd
dd<05>Zdd<07>Zdd <09>ZdS) <0B>Lassoa<6F>Selection curve of an arbitrary shape.
The selected path can be used in conjunction with
:func:`~matplotlib.path.Path.contains_point` to select data points
from an image.
Unlike :class:`LassoSelector`, this must be initialized with a starting
point `xy`, and the `Lasso` events are destroyed upon release.
Parameters
----------
ax : `~matplotlib.axes.Axes`
The parent axes for the widget.
xy : (float, float)
Coordinates of the start of the lasso.
callback : callable
Whenever the lasso is released, the `callback` function is called and
passed the vertices of the selected path.
NTcCs<>t<00>||<01>|o|jj|_|jr2|j<02>|jj<07>|_|\}}||fg|_ t
|g|gdddd<04>|_ |j<06> |j <0B>||_ |<00>d|j<0F>|<00>d|j<10>dS)Nr<4E>r<>r<>)r<>rLrar>r?)r)rr,rrr r*r rr<>rr"r<>r0r2r<>r<>)r r*r<>r0rr<>r<>rrrr<00>
s  zLasso.__init__cCsh|<00>|<01>rdS|jdk rV|j<01>|j|jf<02>t|j<01>dkrF|<00>|j<01>|jj<08> |j
<EFBFBD>d|_|<00> <0B>dS)Nr<4E>) r%r<>r/r<>r<>r<>r0r*r<>r<>r"r5)r r$rrrr<><00>
s

 zLasso.onreleasecCs<>|<00>|<01>rdS|jdkrdS|j|jkr,dS|jdkr:dS|j<01>|j|jf<02>|j<08> t
t |j<01><00><01>|j r<>|j <0A>|j<0F>|j<03>|j<08>|j <0A>|jj<12>n
|j <0A><13>dS)Nr)r%r<>rPr*r<>r/r<>r<>r"rtr<>r<>rr,rrrrr r<>)r r$rrrr<> s

 
z Lasso.onmove)NT)rrrrrr<>r<>rrrrr<><00>
s
 r<>)%rrB<00>numbersrZnumpyr~r<>rrr<>rZpatchesrrr Z
transformsr
<00>objectr rr)r6rZr<>r<>r<>r<>r<>rr#rNrlrzr<>r<>r<>r<>rrrr<00><module>
sN   &*y5 ^sea;0GWV