)Uc@shdZddlZddlmZddlmZmZddlm Z ddl m Z dfdYZ d fd YZ d e fd YZd e fdYZde fdYZde fdYZde fdYZdfdYZdfdYZdfdYZdefdYZdfdYZde fd YZdS(!s GUI Neutral widgets All of these widgets require you to predefine an Axes instance and pass that as the first arg. matplotlib doesn't try to be too smart in layout -- you have to figure out how wide and tall you want your Axes to be to accommodate your widget. iN(tdist(tCirclet Rectangle(tLine2D(tblended_transform_factorytLockDrawcBsDeZdZdZdZdZdZdZdZRS(sT some widgets, like the cursor, draw onto the canvas, and this is not desirable under all circumstaces, like when the toolbar is in zoom-to-rect mode and drawing a rectangle. The module level "lock" allows someone to grab the lock and prevent other widgets from drawing. Use matplotlib.widgets.lock(someobj) to pr cCs d|_dS(N(tNonet_owner(tself((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt__init__scCs+|j|stdn||_dS(sreserve the lock for osalready lockedN(t availablet ValueErrorR(Rto((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt__call__scCs+|j|stdnd|_dS(srelease the locksyou do not own this lockN(R R RR(RR ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pytrelease"scCs|j p|j|S(sdrawing is available to o(tlockedtisowner(RR ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR (scCs |j|kS(so owns the lock(R(RR ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR,scCs |jdk S(sthe lock is heldN(RR(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR0s( t__name__t __module__t__doc__R R RR RR(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs     tWidgetcBseZdZeZeZRS(sT OK, I couldn't resist; abstract base class for mpl GUI neutral widgets (RRRtTruetdrawonteventson(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR6stButtoncBsMeZdZd dddZdZdZdZdZdZ RS( s> A GUI neutral button The following attributes are accesible ax - the Axes the button renders into label - a text.Text instance color - the color of the button when not hovering hovercolor - the color of the button when hovering Call "on_clicked" to connect to the button s0.85s0.95c Cs|d k r|j|n|jdd|ddddd|j|_d|_i|_||_|jj j d|j |jj j d|j |jj j d |j |jt|j||jg|jg||_||_||_d S( s ax is the Axes instance the button will be placed into label is a string which is the button text image if not None, is an image to place in the button -- can be any legal arg to imshow (numpy array, matplotlib Image instance, or PIL image) color is the color of the button when not activated hovercolor is the color of the button when the mouse is over it g?tverticalalignmenttcenterthorizontalalignmentt transformitbutton_press_eventtbutton_release_eventtmotion_notify_eventN(Rtimshowttextt transAxestlabeltcntt observerstaxtfiguretcanvast mpl_connectt_clickt_releaset_motiont set_navigatetFalsetset_axis_bgcolort set_xtickst set_ytickstcolort hovercolort _lastcolor(RR&R#timageR2R3((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR Os&          cCsR|j|jkrdS|js#dS|jj|jkrN|jj|jndS(N(tinaxesR&RR(t mouse_grabbert grab_mouse(Rtevent((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR*xs  cCs}|jj|jkrdS|jj|j|js9dS|j|jkrOdSx'|jjD]\}}||q_WdS(N(R(R7R&t release_mouseRR6R%titems(RR9tcidtfunc((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR+s cCsu|j|jkr|j}n |j}||jkrq|jj|||_|jrq|jjjj qqndS(N( R6R&R3R2R4R/RR'R(tdraw(RR9tc((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR,s    cCs)|j}||j|<|jd7_|S(s When the button is clicked, call this func with event A connection id is returned which can be used to disconnect i(R$R%(RR=R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt on_clickeds  cCs&y|j|=Wntk r!nXdS(s*remove the observer with connection id cidN(R%tKeyError(RR<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt disconnects N( RRRRR R*R+R,R@RB(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRAs (  tSlidercBsYeZdZddeed d edZdZdZdZdZ dZ RS( s+ A slider representing a floating point range The following attributes are defined ax : the slider axes.Axes instance val : the current slider value vline : a Line2D instance representing the initial value poly : A patch.Polygon instance which is the slider valfmt : the format string for formatting the slider text label : a text.Text instance, the slider label closedmin : whether the slider is closed on the minimum closedmax : whether the slider is closed on the maximum slidermin : another slider - if not None, this slider must be > slidermin slidermax : another slider - if not None, this slider must be < slidermax dragging : allow for mouse dragging on slider Call on_changed to connect to the slider event g?s%1.2fc Ks||_||_||_||_||_|j||dd| |_|j|dddddd|_||_ |j g|j ||f|j g|j t|jjjd|j|jjjd|j| r|jjjd|jn|jd d |d |jd d dd|_|jdd ||d |jd d dd|_d|_i|_||_||_| |_| |_t|_dS(s Create a slider from valmin to valmax in axes ax; valinit - the slider initial position label - the slider label valfmt - used to format the slider value closedmin and closedmax - indicate whether the slider interval is closed slidermin and slidermax - be used to contrain the value of this slider to the values of other sliders. additional kwargs are passed on to self.poly which is the matplotlib.patches.Rectangle which draws the slider. See the matplotlib.patches.Rectangle documentation for legal property names (eg facecolor, edgecolor, alpha, ...) iiR2trtlwRRRg{Gzg?RRRRtrightgRQ?tleftN(R&tvalmintvalmaxtvaltvalinittaxvspantpolytaxvlinetvlinetvalfmtR1tset_xlimR0R-R.R'R(R)t_updateR!R"R#tvaltextR$R%t closedmint closedmaxt slidermint slidermaxt drag_active( RR&R#RHRIRKRPRTRURVRWtdraggingtkwargs((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR s<     $             cCsj|jdkrdS|jdkrS|j|jkrSt|_|jj|jn|js`dS|jdks|jdkr|j|jkrt|_|jj |jdS|j }||j kr|j sdS|j }n(||j kr |jsdS|j }n|jdk r1||jjkr1dSn|jdk rY||jjkrYdSn|j|dS(supdate the slider positioniNRR(tbuttontnameR6R&RRXR(R8R.R:txdataRHRTRIRURVRRJRWtset_val(RR9RJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRRs8!  !      cCs|jj}|df|d<|df|d<||j_|jj|j||jrn|jjjj n||_ |j sdSx'|j j D]\}}||qWdS(Niiii(RMtxyRStset_textRPRR&R'R(R>RJRR%R;(RRJR_R<R=((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR^s     cCs)|j}||j|<|jd7_|S(s When the slider valud is changed, call this func with the new slider position A connection id is returned which can be used to disconnect i(R$R%(RR=R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt on_changed's  cCs&y|j|=Wntk r!nXdS(s*remove the observer with connection id cidN(R%RA(RR<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRB3s cCs)|j|jkr%|j|jndS(s/reset the slider to the initial value if neededN(RJRKR^(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pytreset8sN( RRRRRR RRR^RaRBRb(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRCs  ; $ t CheckButtonscBs2eZdZdZdZdZdZRS(s A GUI neutral radio button The following attributes are exposed ax - the Axes instance the buttons are in labels - a list of text.Text instances lines - a 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 box is not checked rectangles - a list of patch.Rectangle instances Connect to the CheckButtons with the on_clicked method c Cs|jg|jg|jtt|dkrodt|d}tjd||t|}nd}dg}d}|j}g|_g|_ g|_ idd6dd 6|j d 6d d 6}xvt ||D]e\} } |j d| | d |j d ddd} |d|d} } d| | d}} td|| fd| d| d|d |j }t||| g| | | g|}t||| g| | | g|}|j|||j|||jj| |j j||j j||f|j||j||j||d7}qW|jjjd|j||_d|_i|_dS(s Add check buttons to axes.Axes instance ax labels is a len(buttons) list of labels as strings actives is a len(buttons) list of booleans indicating whether the button is active ig?g?g?itkR2g?t linewidthRtbutttsolid_capstyleRRGRRg@g?R_twidththeightt facecolorRN(R0R1R-R.tlentnptlinspacetget_axis_bgcolortlabelstlinest rectanglesR"tzipR!RRt set_visibletappendt add_patchtadd_lineR'R(R)t_clickedR&R$R%(RR&RotactivestdytysR$taxcolort lineparamstyR#tttwthtxtptl1tl2((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR NsN   "        &&     c Cs6|jdkrdS|j|jkr)dSxt|j|j|jD]\}}}|jj|j |j s|jj|j |j rE|\}}|j |j |j |j |}PqEqEWdS|j r|jjjjn|jsdSx-|jjD]\}} | |jqWdS(Ni(R[R6R&RrRqRoRptget_window_extenttcontainsRR}Rst get_visibleRR'R(R>RR%R;tget_text( RR9RR~RpRRtthistR<R=((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRws&+   cCs)|j}||j|<|jd7_|S(s When the button is clicked, call this func with button label A connection id is returned which can be used to disconnect i(R$R%(RR=R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR@s  cCs&y|j|=Wntk r!nXdS(s*remove the observer with connection id cidN(R%RA(RR<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRBs (RRRR RwR@RB(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRc?s  @  t RadioButtonscBs8eZdZdddZdZdZdZRS(sN A GUI neutral radio button The following attributes are exposed ax - the Axes instance the buttons are in activecolor - the color of the button when clicked labels - a list of text.Text instances circles - a list of patch.Circle instances Connect to the RadioButtons with the on_clicked method itbluec Cs||_|jg|jg|jtdt|d}tjd||t|}d}|j}g|_ g|_ xt ||D]\} } |j d| | d|j dddd } ||kr|} n|} td d | fd d d| d|j } |j j| |j j| |j| |d7}qW|jjjd|j||_d|_i|_dS(s Add radio buttons to axes.Axes instance ax labels is a len(buttons) list of labels as strings active is the index into labels for the button that is active activecolor is the color of the button when clicked g?iig?RRRGRRR_g333333?tradiusg?RjRN(t activecolorR0R1R-R.RkRlRmRnRotcirclesRrR!R"RRtRuR'R(R)RwR&R$R%(RR&RotactiveRRyRzR$R{R}R#R~RjR((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR s6              c s|jdkrdS|j|jkr)dS|jjjj|j|jf}tj |d|dgfd}xat |j |j D]F\}}|j j|j|js||r|}|}PqqWdSxE|j D]:}||kr|j}n|jj}|j|qW|jrG|jjjjn|jsTdSx-|jjD]\} } | |jqdWdS(Niics9tj|jd|jdg}t||jkS(Nii(RltarrayRRR(Rtpcirc(tpclicked(sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pytinsides#(R[R6R&R"tinvertedttransform_pointRR}RlRRrRRoRRRRnt set_facecolorRR'R(R>RR%R;R( RR9R_RRR~tinpRR2R<R=((RsE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRws0'"*   cCs)|j}||j|<|jd7_|S(s When the button is clicked, call this func with button label A connection id is returned which can be used to disconnect i(R$R%(RR=R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR@s  cCs&y|j|=Wntk r!nXdS(s*remove the observer with connection id cidN(R%RA(RR<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRBs (RRRR RwR@RB(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs  1  t SubplotToolcBsMeZdZdZdZdZdZdZdZdZ RS(s3 A tool to adjust to subplot params of fig cs\|_jdddddddY}jd_jjdjjttjdd d |jj d t_ j j j jd _ j jttj d d d |jjd t_jj jjd_jjttjdd d |jjdt_jj jjd_jjttjdd d |jjdt_jj jjd_jjttjdd d |jjd t_jj jjd_jjttjdd d |jjd t_jj j jj _!j j_"jj_!jj_"j#ddddg}t$|d_%j jjjjjffd}jj&}tj_&j%j'||j_&dS(s targetfig is the figure to adjust toolfig is the figure to embed the the subplot tool into. If None, a default pylab figure will be created. If you are using this from the GUI RGg?RFg?t toolbarfmtcBseZdZdZRS(cSs ||_dS(N(tslider(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR 4scSs*d|jjj|jjf}||S(Ns%s=%s(RR#RRP(RRR}tfmt((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR 7s"(RRR R (((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR3s is'Click on slider to adjust subplot paramiiRUitbottomiRTittopitwspaceithspaceg?g?g333333?g333333?tResetcsj}t_g}x'D]}|j|jt|_qWxD]}|jqIWx&t|D]\}}||_qmW|_jrjjjjjndS(N(RR.RtRbRrR(R>t targetfig(R9t thisdrawontbsRtb(Rtslidersttoolfig(sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR=ls         N(((Rtsubplots_adjustt add_subplottaxleftt set_titleR-R.RCt subplotparsRGt sliderleftRatfunclefttaxbottomRt sliderbottomt funcbottomtaxrightRFt sliderrightt funcrighttaxtopRt slidertoptfunctoptaxwspaceRt sliderwspacet funcwspacetaxhspaceRt sliderhspacet funchspaceRWRVtadd_axesRt buttonresettvalidateR@(RRRRtbaxR=R((RRRsE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR (sR ******  cCs3|jjd||jr/|jjjndS(NRG(RRRR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs cCs3|jjd||jr/|jjjndS(NRF(RRRR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs cCs3|jjd||jr/|jjjndS(NR(RRRR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs cCs3|jjd||jr/|jjjndS(NR(RRRR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs cCs3|jjd||jr/|jjjndS(NR(RRRR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs cCs3|jjd||jr/|jjjndS(NR(RRRR(R>(RRJ((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs ( RRRR RRRRRR(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR$s f     tCursorcBs5eZdZedZdZdZdZRS(sr A horizontal and vertical line span the axes that and move with the pointer. You can turn off the hline or vline spectively with the attributes horizOn =True|False: controls visibility of the horizontal line vertOn =True|False: controls visibility of the horizontal line And the visibility of the cursor itself with visible attribute cKs||_|jj|_|jjd|j|jjd|jt|_t|_t|_ ||_ |r{t|dRRt set_xdataR]t set_ydatatydataRRRR(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs     cCs~|jrm|jdk r.|jj|jn|jj|j|jj|j|jj |jj n |jj t S(N( RRRR(trestore_regionR&t draw_artistRRtblitRt draw_idleR.(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRRs  (RRRR.R RRRR(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs     t MultiCursorcBs5eZdZedZdZdZdZRS(s Provide a vertical line cursor shared between multiple axes from matplotlib.widgets import MultiCursor from pylab import figure, show, nx t = nx.arange(0.0, 2.0, 0.01) s1 = nx.sin(2*nx.pi*t) s2 = nx.sin(4*nx.pi*t) fig = figure() ax1 = fig.add_subplot(211) ax1.plot(t, s1) ax2 = fig.add_subplot(212, sharex=ax1) ax2.plot(t, s2) multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1) show() c Ks||_||_|dj\}}d||}|rIt|dRR]RRRR(RR9tvmintvmaxtspan((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs"(      cCsk|jrZ|jdk r.|jj|jn|jj|j|jj|jj n |jj t S(sBdraw using newfangled blit or oldfangled draw depending on useblitN( RRRR(RR&RRRRRR.(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pytupdates  c Cs{|jdks|j|r"dS|j|j}}||f|_|jdkr\|}n|}||j}}||kr||}}n|jdkr|jj||jj ||n$|jj ||jj |||j dk rm|j}|jdkr(|jp"|jd}n|jp;|jd}||krZ||}}n|j ||n|j tS(son motion notify eventNRii(RRRR]RRRRtset_xt set_widthtset_yt set_heightRRR.( RR9RR}tvtminvtmaxvRR((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs2     N( RRRRR.R RRRRRRR(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR@s1     tHorizontalSpanSelectorcBseZdZRS(cKs9ddl}|jdttj|||d|dS(NisUse SpanSelector instead!R(twarningstwarntDeprecationWarningRR (RR&RRZR((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR s (RRR (((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRstRectangleSelectorc BsweZdZdd d ed d dd dZdZdZdZdZ dZ d Z d Z d Z RS( s Select a min/max range of the x axes for a matplotlib Axes Example usage:: from matplotlib.widgets import RectangleSelector from pylab import * 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 = arange(100)/(99.0) y = sin(x) fig = figure ax = subplot(111) ax.plot(x,y) toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='line') connect('key_press_event', toggle_selector) show() tboxtdatac CsD||_t|_|jj|_|jjd|j|jjd|j|jjd|j|jjd|j t|_ d|_ d|_ |dkrd}t|_n|dkr.|dkrtdd d d d d dt}n||_tddddt|j|_ |jj|j n|dkr|dkrjtdd ddddd d }n||_tddgddgdt|j|_ |jj|j n||_||_||_||_| dkst| tr| |_nt| tr| g|_n| |_||_d|_ d|_!dS(s 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. There pos_i 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 rect is drawn with rectprops; default rectprops = dict(facecolor='red', edgecolor = 'black', alpha=0.5, fill=False) The line is drawn with lineprops; default lineprops = dict(color='black', linestyle='-', linewidth = 2, alpha=0.5) Use type if you want the mouse to draw a line, a box or nothing between click and actual position ny setting drawtype = 'line', drawtype='box' or drawtype = 'none'. spancoords is one of 'data' or 'pixels'. If 'data', minspanx and minspanx will be interpreted in the same coordinates as the x and ya 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 RRRRtnoneRR Rjtwhitet edgecolortblackRg?tfilliiRR2t linestylet-ReiN(ii("R&RRR'R(R)RRRRRRtto_drawRR.RRRRuRRRvRRtminspanxtminspanyt isinstancetlistt validButtonstintt spancoordstdrawtypet eventpresst eventrelease( RR&RRRRRRRRR[((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR sN+          !   *        cCs+|jr'|jj|jj|_ndS(s!force an update of the backgroundN(RR(RR&RR(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR{s cCs|js tS|jjj|s&tS|jdk rN|j|jkrNtSn|jdkrm|j |j kS|j |j kp|j|jjkS(s&return True if event should be ignoredN( RRR(RR RRR[RR6R&(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs cCs3|j|rdS|jj|j||_tS(son button press eventN(RRRsRRR.(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs  c Cs|jdks|j|r"dS|jjt|jj||_|j dkr|jj |jj }}|jj |jj }}nP|j dkr|jj |jj }}|jj |jj }}n td||kr||}}n||kr||}}n||}||}|jdk oC||jk}|jdk oa||jk} |jdkr|s| rdS|jdkr|r| rdS|j|j|jd|_d|_tS(son button release eventNR tpixelss%spancoords must be "data" or "pixels"R R(RRRRRsR.R(R>RRR]RRR}R RRRR( RR9RtyminRtymaxtspanxtspanyt xproblemst yproblems((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs8         cCsk|jrZ|jdk r.|jj|jn|jj|j|jj|jj n |jj t S(sBdraw using newfangled blit or oldfangled draw depending on useblitN( RRRR(RR&RRRRRR.(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs  cCsD|jdks|j|r"dS|j|j}}|jdkr|jj|}}|jj|}}||kr||}}n||kr||}}n|jj||jj||jj |||jj |||j t S|jdkr@|jj |jj|g|jj|g|j t SdS(s,on motion notify event if box/line is wantedNR R(RRRR]RRRRRRRRR.tset_data(RR9RR}tminxtmaxxtminytmaxy((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs*    cCs ||_dS(s Use this to activate / deactivate the RectangleSelector from your program with an boolean variable 'active'. N(R(RR((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt set_activescCs|jS(s0 to get status of active mode (boolean variable)(R(R((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyt get_activesN(RRRRR.R RRRRRRR)R*(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs!   Z   (  tLassocBs)eZdedZdZdZRS(c Cs||_|j|_|jj|_||_|rQ|jj|jj|_n|\}}||fg|_t|g|gdddddd|_ |jj |j ||_ g|_ |j j |jjd|j|j j |jjd|jdS( NRRR2RREiRR(RR'R(RRRRtvertsRRRvtcallbackRRtR)t onreleaseR(RR&R_R-RRR}((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR s    *  "cCs|jdk rl|jj|j|jft|jdkrS|j|jn|jjj |j nd|_x!|j D]}|j j |qWdS(Ni(R,RRtR]RRkR-RRptremoveRRR(R(RR9R<((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR.s cCs|jdkrdS|j|jkr)dS|jdkr<dS|jj|j|jf|jj t |j|j r|j j |j|jj|j|j j|jjn |j jdS(Ni(R,RR6RR[RtR]RRR$RrRR(RRRRRR(RR9((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyRs N(RRRRR R.R(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyR+s (RtnumpyRltmlabRtpatchesRRRpRt transformsRRRRRCRcRRRRRRRR+(((sE/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/widgets.pyts& % fwnPI