)Uc@sdZddljZddljZddljZ ddl Z ddlm Z m Z mZmZmZddlmZddlmZmZddlmZddlmZddljZddlmZdd lmZeZ d Zd d Z!d dZ"dej#fdYZ$de$fdYZ%de%fdYZ&de%fdYZ'de$fdYZ(de$fdYZ)de$fdYZ*de$fdYZ+de+fd YZ,d!e$fd"YZ-dd#lm.Z.d$ej#e.fd%YZ/d&e0fd'YZ1d(e1fd)YZ2d*e1fd+YZ3e4d,kre5j6d-Z7e7j8e5j9d.Z:e;Z<e j=d/j>d0d0d1Z?e-e?d2d3d4dd5de<ZAe:jBeAeAjCdJe-e?d2d3d4dd5de<ZDe/eDdKd8dLd:d;d<d=d>eEd?d@dAe;dBdCdDdEdFddGe;dHdIZFe:jBeFe5jGe5jHndS(Ms The OffsetBox is a simple container artist. The child artist are meant to be drawn at a relative position to its parent. The [VH]Packer, DrawingArea and TextArea are derived from the OffsetBox. The [VH]Packer automatically adjust the relative postisions of their children, which should be instances of the OffsetBox. This is used to align similar artists together, e.g., in legend. The DrawingArea can contain any Artist as a child. The DrawingArea has a fixed width and height. The position of children relative to the parent is fixed. The TextArea is contains a single Text instance. The width and height of the TextArea instance is the width and height of the its child text. iN(tBboxtBboxBasetTransformedBboxtIdentityTransformtBboxTransformFrom(tFontProperties(tFancyBboxPatchtFancyArrowPatch(trcParams(t docstring(t BboxImage(t bbox_artistcOstrt||ndS(N(tDEBUGt mbbox_artist(targstkwargs((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR (stfixedc Cst|\}}|dkrtjjdgg|D]}||^q4}|d }|dkru|d|}n||fS|dkr|t|t|d}tjjdgg|D]}||^q}|d }||fS|dkrt|} |dkr(| |t|}nt|t|| }tj gt t|D]} | || ^q[}||fSt d|fdS( s Geiven a list of (width, xdescent) of each boxes, calculate the total width and the x-offset positions of each items according to *mode*. xdescent is analagous to the usual descent, but along the x-direction. xdescent values are currently ignored. *wd_list* : list of (width, xdescent) of boxes to be packed. *sep* : spacing between boxes *total* : Intended total length. None if not used. *mode* : packing mode. 'fixed', 'expand', or 'equal'. Riitexpandg?tequalsUnknown mode : %sN( tziptnptaddt accumulatetNonetsumtlentmaxtfloattarraytranget ValueError( twd_listttotaltseptmodetw_listtd_listtwtoffsets_toffsetstmaxhti((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt_get_packed_offsets1s(  0    0     6 tbaselinecCs|d kr4tg|D]\}}|^q}n|dkrtg|D]\}}||^qJ}tg|D]\}}|^qs}||}g|D]\}}d^q}n|d krd}g|D]\}}|^q}n|d kr*d}g|D]\}}|||^q}nS|dkrjd}g|D]\}}||d|^qC}ntd |f|||fS( s* Geiven a list of (height, descent) of each boxes, align the boxes with *align* and calculate the y-offsets of each boxes. total width and the offset positions of each items according to *mode*. xdescent is analagous to the usual descent, but along the x-direction. xdescent values are currently ignored. *hd_list* : list of (width, xdescent) of boxes to be aligned. *sep* : spacing between boxes *height* : Intended total length. None if not used. *align* : align mode. 'baseline', 'top', 'bottom', or 'center'. R+gtleftttoptrighttbottomtcenterg?sUnknown Align mode : %sN(R,stop(R.R/(RRR(thd_listtheighttalignthtdtheight_descenttdescentR'((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt_get_aligned_offsets`s$ ( )% " " * .t OffsetBoxcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(s The OffsetBox is a simple container artist. The child artist are meant to be drawn at a relative position to its parent. cOs/tt|j||g|_d|_dS(Ni(ii(tsuperR9t__init__t _childrent_offset(tselfRR((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;s cCs;tjj||x!|jD]}|j|q WdS(s^ Set the figure accepts a class:`~matplotlib.figure.Figure` instance N(tmartisttArtistt set_figuret get_children(R>tfigtc((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRAscCsFx9|jD]+}|j|\}}|r ||fSq WtifS(N(RBtcontainstFalse(R>t mouseeventRDtatb((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyREs cCs ||_dS(sT Set the offset accepts x, y, tuple, or a callable object. N(R=(R>txy((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt set_offsetscCs3t|jr(|j|||||S|jSdS(sC Get the offset accepts extent of the box N(tcallableR=(R>twidthR2txdescenttydescenttrenderer((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt get_offsetscCs ||_dS(s6 Set the width accepts float N(RM(R>RM((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt set_widthscCs ||_dS(s7 Set the height accepts float N(R2(R>R2((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt set_heightscCs&g|jD]}|jr |^q S(s? Return a list of visible artists it contains. (R<t get_visible(R>RD((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytget_visible_childrenscCs|jS(s7 Return a list of artists it contains. (R<(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRBscCstddS(Nt(t Exception(R>RP((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytget_extent_offsetsscCs.|j|\}}}}}||||fS(s@ Return with, height, xdescent, ydescent of box (RX(R>RPR%R4txdtydR'((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt get_extentsc Cs`|j|\}}}}}|j|||||\}}tjj||||||S(s8 get the bounding box in display space. (RXRQt mtransformsRt from_bounds( R>RPR%R4RYRZR'tpxtpy((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytget_window_extents!c Cs|j|\}}}}}|j|||||\}}xQt|j|D]:\} \} } | j|| || f| j|qUWt||dtdtdddS(sm Update the location of children if necessary and draw them to the given *renderer*. tfilltpropstpadgN( RXRQRRURKtdrawR RFtdict( R>RPRMR2RNROR'R^R_RDtoxtoy((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRds !((t__name__t __module__t__doc__R;RARERKRQRRRSRURBRXR[R`Rd(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR9s          t PackerBasecBs&eZddddddddZRS(cCsVtt|j||_||_||_||_||_||_||_ dS(s *pad* : boundary pad *sep* : spacing between items *width*, *height* : width and height of the container box. calculated if None. *align* : alignment of boxes. Can be one of 'top', 'bottom', 'left', 'right', 'center' and 'baseline' *mode* : packing mode .. note:: *pad* and *sep* need to given in points and will be scale with the renderer dpi, while *width* and *hight* need to be in pixels. N( R:RkR;R2RMR!RcR"R3R<(R>RcR!RMR2R3R"tchildren((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;s      N(RhRiRR;(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRks tVPackercBs5eZdZddddddddZdZRS(s The VPacker has its children packed vertically. It automatically adjust the relative postisions of children in the drawing time. R+RcCs,tt|j|||||||dS(s *pad* : boundary pad *sep* : spacing between items *width*, *height* : width and height of the container box. calculated if None. *align* : alignment of boxes *mode* : packing mode .. note:: *pad* and *sep* need to given in points and will be scale with the renderer dpi, while *width* and *hight* need to be in pixels. N(R:RmR;(R>RcR!RMR2R3R"Rl((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;scCs|jd}|j|}|j|}|jdk rxH|jD]7}t|trE|jdkrE|j |jqEqEWng|jD]}|j |^q}g|D](\}}} } ||| || f^q}g|D]\}}} } || f^q} t | |j|j \} } }g|D]\}}} } || f^q3}t ||j||j\}}|g|D]\}}} } | ^q}||d}||}||}| d||d|| |||t||fS(sN update offset of childrens and return the extents of the box g?RiiN(tpoints_to_pixelsRcR!RMRRUt isinstanceRkR"RRR[R8R3R*R2R(R>RPtdpicorRcR!RDtwhd_listR%R4RYRZRRMRNtxoffsetst pack_listR2t yoffsets_tyoffsetsRO((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRX.s.  (5++ )  N(RhRiRjRR;RX(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRms   tHPackercBs5eZdZddddddddZdZRS(s The HPacker has its children packed horizontally. It automatically adjust the relative postisions of children in the drawing time. R+RcCs,tt|j|||||||dS(s *pad* : boundary pad *sep* : spacing between items *width*, *height* : width and height of the container box. calculated if None. *align* : alignment of boxes *mode* : packing mode .. note:: *pad* and *sep* need to given in points and will be scale with the renderer dpi, while *width* and *hight* need to be in pixels. N(R:RvR;(R>RcR!RMR2R3R"Rl((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;[scCs|jd}|j|}|j|}g|jD]}|j|^q6}|srd|d|||gfS|jdkrtg|D]\}}} } || ^q} tg|D]\}}} } | ^q} | | } n|jd|} g|D]\}}} } || f^q}t||j|j \} } }g|D]\}}} } || f^qL}t ||j ||j \}}|g|D]\}}} } | ^q}|dd}||}|d|| d|||| |t ||fS(sN update offset of childrens and return the extents of the box g?iiN(RnRcR!RUR[R2RRR8R3R*RMR"R(R>RPRpRcR!RDRqR%R4RYRZR6ROR2R1RuRsRMt xoffsets_RrRN((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRXos0  (/+ ++ ) N(RhRiRjRR;RX(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRvVs   t DrawingAreacBsheZdZddedZdZdZdZdZdZ dZ d Z d Z RS( s The DrawingArea can contain any Artist as a child. The DrawingArea has a fixed width and height. The position of children relative to the parent is fixed. gcCsytt|j||_||_||_||_tj|_ |j j |j j ddtj|_ dS(s *width*, *height* : width and height of the container box. *xdescent*, *ydescent* : descent of the box in x- and y-direction. iN( R:RxR;RMR2RNROR\tAffine2Dtoffset_transformtcleart translatet dpi_transform(R>RMR2RNROtclip((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;s     cCs|j|jS(sf Return the :class:`~matplotlib.transforms.Transform` applied to the children (R}Rz(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt get_transformscCsdS(s+ set_transform is ignored. N((R>tt((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt set_transformscCs5||_|jj|jj|d|ddS(sj set offset of the container. Accept : tuple of x,y cooridnate in disokay units. iiN(R=RzR{R|(R>RJ((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRKs  cCs|jS(s1 return offset of the container. (R=(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRQscCsN|j|\}}}}|j\}}tjj||||||S(s8 get the bounding box in display space. (R[RQR\RR](R>RPR%R4RYRZRfRg((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR`scCs;|jd}|j||j||j||j|fS(s@ Return with, height, xdescent, ydescent of box g?(RnRMR2RNRO(R>RPtdpi_cor((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR[scCs'|jj||j|jdS(s?Add any :class:`~matplotlib.artist.Artist` to the container boxN(R<tappendRR(R>RH((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt add_artistsc Csv|jd}|jj|jj||x|jD]}|j|q9Wt||dtdtdddS(s# Draw the children g?RaRbRcgN( RnR}R{tscaleR<RdR RFRe(R>RPRRD((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRds  ( RhRiRjtTrueR;RRRKRQR`R[RRd(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRxs    tTextAreacBseZdZddedZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZRS(s The TextArea is contains a single Text instance. The text is placed at (0,0) with baseline+left alignment. The width and height of the TextArea instance is the width and height of the its child text. cCs|dkri}n|jds1d|dtst textpropstmultilinebaselinetminimumdescent((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR; s      cCs|jj|dS(sset textN(Rtset_text(R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR.scCs |jjS(sget text(Rtget_text(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR2scCs ||_dS(s Set multilinebaseline . If True, baseline for multiline text is adjusted so that it is (approximatedly) center-aligned with singleline text. N(R(R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytset_multilinebaseline6scCs|jS(s) get multilinebaseline . (R(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytget_multilinebaselineAscCs ||_dS(s Set minimumdescent . If True, extent of the single line text is adjusted so that it has minimum descent of "p" N(R(R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytset_minimumdescentHscCs|jS(s% get minimumdescent. (R(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytget_minimumdescentRscCsdS(s+ set_transform is ignored. N((R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRYscCs5||_|jj|jj|d|ddS(sj set offset of the container. Accept : tuple of x,y cooridnate in disokay units. iiN(R=RzR{R|(R>RJ((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRK`s  cCs|jS(s1 return offset of the container. (R=(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRQlscCsN|j|\}}}}|j\}}tjj||||||S(s8 get the bounding box in display space. (R[RQR\RR](R>RPR%R4RYRZRfRg((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR`sscCsX|jj|jj\}}|jd|jjdt\}}}|jj|\}}|j|j} } |dd} |j| |jjd|\}} } | }|jj t |dkr |j r d| d||}|jj d|||}n?t ||| |}|jr>t ||}n||} | | d|fS(Ntlptismathiiig?g(Rt is_math_texttget_text_width_height_descentt_fontpropertiesRFt _get_layoutRMR2RR{RRR|RR(R>RPt clean_lineRt_th_td_tbboxtinfoR%R4tlinethhtddR5td_newth_d((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR[|s&!!    c Cs6|jj|t||dtdtdddS(s# Draw the children RaRbRcgN(RRdR RFRe(R>RP((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRdsN(RhRiRjRRR;RRRRRRRRKRQR`R[Rd(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRs  !       %tAuxTransformBoxcBs_eZdZdZdZdZdZdZdZdZ dZ d Z RS( sX Offset Box with the aux_transform . Its children will be transformed with the aux_transform first then will be offseted. The absolute coordinate of the aux_transform is meaning as it will be automaticcaly adjust so that the left-lower corner of the bounding box of children will be set to (0,0) before the offset trnasform. It is similar to drawing area, except that the extent of the box is not predetemined but calculated from the window extent of its children. Furthermore, the extent of the children will be calculated in the transformed coordinate. cCse||_tj|tj|_|jj|jjddtj|_|jjdS(Ni( t aux_transformR9R;R\RyRzR{R|tref_offset_transform(R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;s   cCs'|jj||j|jdS(s?Add any :class:`~matplotlib.artist.Artist` to the container boxN(R<RRR(R>RH((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRscCs|j|j|jS(sf Return the :class:`~matplotlib.transforms.Transform` applied to the children (RRRz(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRs cCsdS(s+ set_transform is ignored. N((R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRscCs5||_|jj|jj|d|ddS(sj set offset of the container. Accept : tuple of x,y cooridnate in disokay units. iiN(R=RzR{R|(R>RJ((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRKs  cCs|jS(s1 return offset of the container. (R=(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRQscCsN|j|\}}}}|j\}}tjj||||||S(s8 get the bounding box in display space. (R[RQR\RR](R>RPR%R4RYRZRfRg((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR`scCs|jj}|jj|jjg|jD]}|j|^q3}tjj|}|jj |j |j |jj |}|jj ||j|jddfS(Ng(Rzt to_valuesRR{R<R`R\RtunionR|tx0ty0tmatrix_from_valuest set_matrixRMR2(R>RPt_offRDtbboxestubtmtx((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR[s  %c CsGx|jD]}|j|q Wt||dtdtdddS(s# Draw the children RaRbRcgN(R<RdR RFRe(R>RPRD((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRds( RhRiRjR;RRRRKRQR`R[Rd(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRs      tAnchoredOffsetboxcBseZdZdZddddedddZdZdZdZ dZ d Z dd Z d Z dd Zdd ZdZdZRS(s6 An offset box placed according to the legend location loc. AnchoredOffsetbox has a single child. When multiple children is needed, use other OffsetBox class to enlose them. By default, the offset box is anchored against its parent axes. You may explicitly specify the bbox_to_anchor. ig?g?c Ks"tt|j| |j|||j|||_||_||_|dkrst dt d|_ nMt |t rt ||_ d|kr|j jt dqn ||_ tdddddddd d d d |j jd t|_|jjddd||_dS(s loc is a string or an integer specifying the legend location. The valid location codes are:: 'upper right' : 1, 'upper left' : 2, 'lower left' : 3, 'lower right' : 4, 'right' : 5, 'center left' : 6, 'center right' : 7, 'lower center' : 8, 'upper center' : 9, 'center' : 10, pad : pad around the child for drawing a frame. given in fraction of fontsize. borderpad : pad between offsetbox frame and the bbox_to_anchor, child : OffsetBox instance that will be anchored. prop : font property. This is only used as a reference for paddings. frameon : draw a frame box if True. bbox_to_anchor : bbox to anchor. Use self.axes.bbox if None. bbox_transform : with which the bbox_to_anchor will be transformed. tsizeslegend.fontsizeRJgRMg?R2t facecolorR%t edgecolortktmutation_scaletsnaptsquareRciN(gg(R:RR;tset_bbox_to_anchort set_childtloct borderpadRcRRRtpropRoRetset_sizeRtget_size_in_pointsRtpatcht set_boxstylet _drawFrame( R>RRcRtchildRtframeontbbox_to_anchortbbox_transformR((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;(s(&         cCs ||_dS(sset the child to be anchoredN(t_child(R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRlscCs|jS(sreturn the child(R(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt get_childpscCs |jgS(sreturn the list of children(R(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRBtscCsn|jj|\}}}}|j|jj}|j|}|d||d|||||fS(sq return the extent of the artist. The extent of the child added with the pad is returned i(RR[RnRRRc(R>RPR%R4RYRZtfontsizeRc((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR[ys! cCsI|jdkr|jjS|j}|dkr5|jSt|j|SdS(sB return the bbox that the legend will be anchored N(t_bbox_to_anchorRtaxesRt_bbox_to_anchor_transformR(R>t transform((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytget_bbox_to_anchors    cCs|dkst|tr'||_nuyt|}Wn'tk r`tdt|nX|dkr|d|dddg}ntj ||_||_ dS(sF set the bbox that the child will be anchored. *bbox* can be a Bbox instance, a list of [left, bottom, width, height], or a list of [left, bottom] where the width and height will be assumed to be zero. The bbox will be transformed to display coordinate by the given transform. sInvalid argument for bbox : %siiiN( RRoRRRt TypeErrorRtstrRR]R(R>RRtl((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRs    cCsg|j||j|\}}}}|j|||||\}}tj||||||S(s8 get the bounding box in display space. (t_update_offset_funcR[RQRR](R>RPR%R4RYRZRfRg((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR`s !cCsG|dkr'|j|jj}n||d}|j|dS(ss Update the offset func which depends on the dpi of the renderer (because of the padding). c Ssdtjdd||}|j|}|j} |j|j|| |\} } | || |fS(Ni(RR]RRt_get_anchored_bboxR( R%R4RYRZRPRR>RRRRR((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR=s   N(RRnRRRK(R>RPRR=((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRs  cCsB|jj|j|j|j|j|r>|jj|ndS(N(Rt set_boundsRRRMR2tset_mutation_scale(R>RR((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt update_framesc Cs|jsdS|j|jj}|j|||jrs|j|}|j|||jj |n|j |\}}}}|j |||||\}} |j j || f|j j |dS(sdraw the artistN(RTRnRRRRR`RRRdR[RQRRK( R>RPRRRMR2RNROR^R_((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRds  !c Cstd\ }}}}} } } } } }}i d|6d|6d|6d| 6d| 6d| 6d| 6d| 6d |6d |6}||}|j| }|j|d |}|j|jfS( s{ return the position of the bbox anchored at the parentbbox with the loc code, with the borderpad. i tNEtNWtSWtSEtEtWtStNtCt container(RtpaddedtanchoredRR(R>RRt parentbboxRtBESTtURtULtLLtLRtRtCLtCRtLCtUCRt anchor_coefsRDRt anchored_box((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRs-   N(RhRiRjtzorderRRR;RRRBR[RRR`RRRdR(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRs"  @        t AnchoredTextcBs eZdZddddZRS(s% AnchoredOffsetbox with Text g?g?c Kset|d|dt|_|jjj}tt|j|d|d|d|jd||dS(sC *s* : string *loc* : location code *prop* : font property *pad* : pad between the text and the frame as fraction of the font size. *borderpad* : pad between the frame and the axes (or bbox_to_anchor). other keyword parameters of AnchoredOffsetbox are also allowed. RRRcRRRN(RRFttxtRtget_fontpropertiesR:RR;(R>RRRcRRRtfp((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;s  ! N(RhRiRjRR;(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR st OffsetImagec Bs}eZdd d d d ddeed ZdZdZdZdZ dZ dZ d Z d Z d ZRS( ig@c Ks| |_td|jd|d|d|d|d|d|d| | |_|jg|_|j||j|tj|dS( NRtcmaptnormt interpolationtorigint filternormt filterradtresample( t_dpi_corR R`timageR<tset_zoomtset_dataR9R;( R>tarrtzoomRRRRRRRRR((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;%s    cCs)tj||_|jj|jdS(N(Rtasarrayt_dataRR(R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRGscCs|jS(N(R (R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytget_dataKscCs ||_dS(N(t_zoom(R>R ((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRNscCs|jS(N(R (R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytget_zoomQscCs|jS(s1 return offset of the container. (R=(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRQescCs |jgS(N(R(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRBkscCsN|j|\}}}}|j\}}tjj||||||S(s8 get the bounding box in display space. (R[RQR\RR](R>RPR%R4RYRZRfRg((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR`nsc Csq|jr|jd}nd}|j}|j}|jd \}}||||}}||ddfS(Ng?ii(RRnRR tshape( R>RPRR tdatatnytnxR%R4((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR[ws   cCs|jj|dS(s# Draw the children N(RRd(R>RP((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRdsN(RhRiRRFRR;RR RRRQRBR`R[Rd(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR$s$        (t_AnnotationBasetAnnotationBboxc BseZdZdZdZejdddeddddddd Z dZ dZ d Z dd Z dd Zd Zd ZdZRS(sD Annotation-like class, but with offsetbox instead of Text. icCsd|jd|jdfS(NsAnnotationBbox(%g,%g)ii(RJ(R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt__str__sRg?g?c Ks/||_| |_|j| | dk r^|jjdd|_tdd|j|_nd|_d|_tj ||d|d|d|d|t j j || | |_ t d dd d d d ddddd|jjdt|_|jjdd|| r"|jj| n||_dS(so *offsetbox* : OffsetBox instance *xycoords* : same as Annotation but can be a tuple of two strings which are interpreted as x and y coordinates. *boxcoords* : similar to textcoords as Annotation but can be a tuple of two strings which are interpreted as x and y coordinates. *box_alignment* : a tuple of two floats for a vertical and horizontal alignment of the offset box w.r.t. the *boxcoords*. The lower-left corner is (0.0) and upper-right corner is (1.1). other parameters are identical to that of Annotation. trelposg?iitxytexttxycoordst textcoordstannotation_clipRJgRMg?R2RR%RRRRRRcN(g?g?(ii(ii(gg(t offsetboxt arrowpropst set_fontsizeRtpopt _arrow_relposRt arrow_patchRR;R?R@t_box_alignmentRRRRRRtsetR(R>RRJtxyboxRt boxcoordsRRcRt box_alignmentt bboxpropsRRR((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;s0             cCs"|jj|\}}||fS(N(RRE(R>teventRttinfo((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyREscCs2|j|jg}|jr.|j|jn|S(N(RRR R(R>Rl((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRBs cCsI|jdk r"|jj|n|jj|tjj||dS(N(R RRARR?R@(R>RC((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRAscCs/|dkrtd}ntd||_dS(s( set fontsize in points slegend.fontsizeRN(RRRR(R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRs  cCs |jjS(s+ return fontsize in points (RR(R>R((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt get_fontsizescCsd|j|}|j|||j|j}|jj||jr`|jj|ndS(s?Update the pixel positions of the annotated point and the text.N(t_get_position_xyt_update_position_xyboxRnR)RRR (R>RPtxy_pixelR((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytupdate_positionss  cCs1|j\}}t|jtr||j\}}|j||||\}}|j||||\} } || } } n!|j||||j\} } |jj|\} }}}|j\}}|jj| || || |||f|jj |}|j j |j |j |j|j|\}}||}}|jr-||}}|jj}|j}|j |j|d} |j |j|d} |jj| | f||f|jj}|jd|}|j|}|jj||jd|j }|jj|ndS(sFUpdate the pixel positions of the annotation text and the arrow patch.iiRtpatchAN(RRoRttuplet_get_xyRR[R!RKR`RRRRRMR2RtcopyRR t set_positionsRRRRnRt set_patchA(R>RPR,txtytxcoordtycoordtx1ty1tx2ty2tox0toy0R%R4RYRZt_fwt_fhRtox1toy1RRR5RtfsRR.((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR+s8!.     cCs|dk r||_n|js(dS|j|}|j||sMdS|j||jdk r|jjdkr|jdk r|j|j_n|jj|n|j r|j j|n|j j|dS(sN Draw the :class:`Annotation` object to the given *renderer*. N( Rt _rendererRTR*t _check_xyR-R tfigureRdRRR(R>RPR,((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRdMs    ! N(g?g?(RhRiRjRRR tdedent_interpdRRR;RERBRARR)R-R+Rd(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRs* 8    ;t DraggableBasecBskeZdZedZdZdZdZdZdZ dZ dZ d Z d Z RS( s, helper code for a draggable artist (legend, offsetbox) The derived class must override following two method. def saveoffset(self): pass def update_offset(self, dx, dy): pass *saveoffset* is called when the object is picked for dragging and it is meant to save reference position of the artist. *update_offset* is called during the dragging. dx and dy is the pixel offset from the point where the mouse drag started. Optionally you may override following two methods. def artist_picker(self, artist, evt): return self.ref_artist.contains(evt) def finalize_offset(self): pass *artist_picker* is a picker method that will be used. *finalize_offset* is called when the mouse is released. In current implementaion of DraggableLegend and DraggableAnnotation, *update_offset* places the artists simply in display coordinates. And *finalize_offset* recalculate their position in the normalized axes coordinate and set a relavant attribute. cCs||_t|_||_|jjj|_|jjd|j}|jjd|j}|j |j ||g|_ dS(Nt pick_eventtbutton_release_event( t ref_artistRFt got_artistt _use_blitREtcanvast mpl_connectton_pickt on_releaset set_pickert artist_pickertcids(R>RJtuse_blittc2tc3((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;s   cCsM|jrI|j|j}|j|j}|j|||jjndS(N(RKR4tmouse_xR5tmouse_yt update_offsetRMRd(R>tevttdxtdy((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt on_motions  cCs|jr|j|j}|j|j}|j|||jj|j|j j |j j j |jj |j j jndS(N(RKR4RWR5RXRYRMtrestore_regiont backgroundRJRdREt_cachedRenderertblitR(R>RZR[R\((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyton_motion_blits cCs|j|jkr|jj|_|jj|_t|_|j r|jj t|j j |j j |jjj|_|jj |jjj|j j|jjj|j jd|j|_n|j jd|j|_|jndS(Ntmotion_notify_event(tartistRJRGR4RWR5RXRRKRLt set_animatedRMRdtcopy_from_bboxRERR_R`RaRNRbt_c1R]t save_offset(R>RZ((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyROs   cCsR|jrN|jt|_|jj|j|jrN|jjtqNndS(N( RKtfinalize_offsetRFRMtmpl_disconnectRgRLRJRe(R>R'((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRPs     cCs(x!|jD]}|jj|q WdS(sdisconnect the callbacksN(RSRMRj(R>tcid((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyt disconnectscCs|jj|S(N(RJRE(R>RdRZ((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRRscCsdS(N((R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRhscCsdS(N((R>R[R\((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRYscCsdS(N((R>((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRis(RhRiRjRFR;R]RbRORPRlRRRhRYRi(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRGis       tDraggableOffsetBoxcBs/eZedZdZdZdZRS(cCs#tj||d|||_dS(NRT(RGR;R(R>RJRRT((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;scCsa|j}|jj}|j|\}}}}|j|||||}|\|_|_dS(N(RRER`R[RQt offsetbox_xt offsetbox_y(R>RRPR%R4RYRZtoffset((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRhs   cCs.|j||j|f}|jj|dS(N(RnRoRRK(R>R[R\t loc_in_canvas((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRYsc CsW|j}|jj}|j|\}}}}|j\}}||||f} | S(N(RRER`R[R=( R>RRPR%R4RYRZRfRgRq((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytget_loc_in_canvass   (RhRiRFR;RhRYRr(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRms   tDraggableAnnotationcBs/eZedZdZdZdZRS(cCs#tj||d|||_dS(NRT(RGR;t annotation(R>RtRT((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyR;sc Cs|j}|j\}}t|jtr|j\}}|j|jj|||\}}|j|jj|||\}} || } } n'|j|jj|||j\} } | | |_|_ d|j_dS(Ns figure pixels( RtRRoRR/R0RMRPRfRg( R>tannR4R5R6R7R8R9R:R;R<R=((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRhs $$'cCsZ|j}|j||j|f|_|j\}}|j|jj|||j}dS(N(RtRfRgRR0RMRPR(R>R[R\RuR4R5RJ((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRYs cCsL|jj}d|j_|jjjjj|}t||j_dS(Ns axes fraction(RtRRRt transAxestinvertedttransform_pointR/(R>Rqtpos_axes_fraction((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRis  (RhRiRFR;RhRYRi(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pyRss   t__main__iiyiigp@R iRRidg?R#iRRR$s offset pointsRRcg?R&tboxstyletroundtfcR5RRt arrowstyles->(idid(g?g?(ii(IRjtmatplotlib.transformst transformsR\tmatplotlib.artistRdR?tmatplotlib.textttextRtnumpyRRRRRRtmatplotlib.font_managerRtmatplotlib.patchesRRt matplotlibRR tmatplotlib.cbooktcbooktmatplotlib.imageR R R RFR R*R8R@R9RkRmRvRxRRRRRRRtobjectRGRmRsRhtpltRERCtclftsubplottaxReRtarangetreshapeRHRtmyimageRRKtmyimage2RRuRdtshow(((sG/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/offsetbox.pytsx ( / &oCCgqnj