Ñò ¿6´Jc@ s&ddklZddkZddkZddkZddkZddkZddkZddkZyddk l Z Wn#e j oddk l Z nXddk l Z lZlZddklZlZlZlZddklZddklZlZlZddklZdd klZdd kl Z l!Z!dd k"l#Z#l$Z$l%Z%dd k&l'Z'dd k(l)Z)ddk*l+Z+ddk l,Z,ddk-l.Z/eZ0d„Z1hdd6dd6dd6Z2defd„ƒYZ3defd„ƒYZ4defd„ƒYZ5e5Z6dZ7dS(iÿÿÿÿ(tdivisionN(tmd5(tverboset __version__trcParams(t RendererBasetGraphicsContextBasetFigureManagerBasetFigureCanvasBase(tMixedModeRenderer(tis_string_liketis_writable_file_liketmaxdict(trgb2hex(tFigure(tfindfonttFontProperties(tFT2FonttKERNING_DEFAULTtLOAD_NO_HINTING(tMathTextParser(tPath(tAffine2D(t_png(tescapecO s@|idtƒ}|||Ž}t|ƒ}t||ƒ}|S(Nt FigureClass(tpopRtFigureCanvasSVGtFigureManagerSVG(tnumtargstkwargsRtthisFigtcanvastmanager((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pytnew_figure_managers  tsquaret projectingtbutttroundt RendererSVGcB s,eZdZedƒZdd„Zd„Zd„Zd„Z d„Z d„Z dd„Z d „Z d „Zhd ei6d ei6d ei6dei6Zd„Zed„Zdd„Zdd„Zd„Zddd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"d„Z#RS(gY@i2cC s«||_||_||_h|_tdp||_h|_nh|_h|_h|_ d|_ h|_h|_ t dƒ|_ |it||||fƒdS(Nssvg.image_inlineitSVG(twidththeightt _svgwritert_groupdRtbasenamet_imagedt_clipdt _char_defst_markerst_path_collection_idt_hatchdRtmathtext_parsertwritet svgProlog(tselfR*R+t svgwriterR.((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt__init__)s             cC s¾|i|ƒ}|djo d}n d|}|iƒdj o|iid|iƒƒn|i||ƒ}|iid||||fƒ|iƒdj o|iidƒndS(Ntsclip-path="url(#%s)"ss<%s style="%s" %s %s/> s(t_get_gc_clip_svgtNonetget_urlR,R6t _get_style(R8telementtdetailstgctrgbFacetclipidtclippathtstyle((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt_draw_svg_element<s    cC s´t|ƒ}|ii|ƒ}|djo_t|ƒ}|ii|ƒ}|djo#tt|ƒƒ}||i| gð?gð¿itnones4is7is N(t get_hatchtget_rgbR4RJR=RRKt hexdigestR,R6t _convert_pathtget_hatch_pathRtscalet translateR ( R8RBRCt HATCH_SIZEtdictkeytidt path_datatfilltpath((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt _get_hatchZs.  -    0c C s$|iƒd j od|i||ƒ}n(|d jo d}nt|d ƒ}|iƒ\}}|d jo d}n9ddig}|D]}|d|q‘~ƒ|f}|iƒ} | oDd|t|iƒd ƒ| |iƒt |i ƒ||i ƒfSd ||i ƒfSd S( st return the style string. style is generated from the GraphicsContext, rgbFace and clippath surl(#%s)RUiR;s,stroke-dasharray: %s; stroke-dashoffset: %f;t,s%fs_fill: %s; stroke: %s; stroke-width: %f; stroke-linejoin: %s; stroke-linecap: %s; %s opacity: %fsfill: %s; opacity: %fN( RVR=RcR t get_dashestjoint get_linewidthRWt get_joinstylet _capstyle_dt get_capstylet get_alpha( R8RBRCRatoffsettseqtdashest_[1]tvalt linewidth((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyR?ws.    5   c C s |iƒ}|iƒ\}}|dj o/|i|ƒ}|i||ƒ}d|}nI|dj o7|i\}}} } |i|| }dtƒ}ndS|ii |ƒ} | djo[dt |ƒi ƒ} |i i d| ƒ|i i |ƒ|i i dƒ| |i|s8sp%ss s (tget_clip_rectanglet get_clip_pathR=t_make_flip_transformRYtboundsR+tlocalsR0RJRRXR,R6( R8RBtcliprectREtclippath_transR`RbtxtytwthR_((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyR<s&    cC sd|o|iid|ƒnB|ii|dƒd|i|<|iid||i|fƒdS(sv Open a grouping element with label *s*. If *gid* is given, use *gid* as the id of the group. s iis N(R,R6R-RJ(R8tstgid((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt open_group´s cC s|iidƒdS(Ns (R,R6(R8R}((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt close_group¿scC stdS(sb if svg.image_noscale is True, compositing multiple images into one is prohibited ssvg.image_noscale(R(R8((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pytoption_image_nocompositeÂssM%f %fsL%f %fs Q%f %f %f %fsC%f %f %f %f %f %fcC s&|tƒiddƒid|iƒS(Ngð?gð¿g(RR[R\R+(R8t transform((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyRtÏs  c C síg}|i}|i}d}|odd|i|if}nd}x–|i|d|ƒD]\}} | tijo d} n|| t|ƒ} |t | ƒdjo|dƒd}n|| ƒ|t | ƒ7}q]Wdi |ƒS(NigtcliptziKs R;( tappendt_path_commandsR*R+R=t iter_segmentsRt CLOSEPOLYttupletlenRf( R8RbR‚RƒR`tappendert path_commandstcurrpostpointstcodetsegment((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyRYÕs$       cC sK|i|ƒ}|i||d|djƒ}|idd|||ƒdS(NRƒRbsd="%s"(RtRYR=RG(R8RBRbR‚RCttrans_and_flipR`((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt draw_pathëscC sl|ii}|i||tƒiddƒƒ}|ii|ƒ} | djo;dt|ƒi ƒ} |d| |fƒ| |i| R;sclip-path="url(#%s)"stsimplifyiþÿÿÿsxlink:href="#%s" x="%f" y="%f"s s(R,R6RYRR[R2RJR=RRXR<RtR‡tFalseRŠR?(R8RBt marker_patht marker_transRbttransRCR6RPtnameRDRER‘tverticesRRyRzRARF((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt draw_markersðs* %      "cC s |ii}g}|dƒx¢t|i|||ƒƒD]…\}\}}t|iƒƒiddƒ}|i||ƒ}d|i|t |ƒi ƒf}|d||fƒ|i |ƒq8W|dƒx(|i ||||||| | | | | |ƒ D]ö\}}}}}|i |ƒ}|iƒ}|dj o|iid|ƒn|dj o|d|ƒnd |||i|f}|i||ƒ}|iid ||fƒ|dj o|d ƒn|dj o|iid ƒqüqüW|id 7_dS(Ns gð?gð¿s coll%x_%x_%ss s sssxlink:href="#%s" x="%f" y="%f"s ssi(R,R6t enumeratet_iter_collection_raw_pathsRt get_matrixR[RYR3RRXR…t_iter_collectionR<R>R=R+R?(R8tmaster_transformRwRERxtpathstall_transformstoffsetst offsetTranst facecolorst edgecolorst linewidthst linestylest antialiasedsturlsR6t path_codestiRbR‚tdR˜txotyotpath_idRBRCRDturlRARF((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pytdraw_path_collection s@             cC sddddddg}d}tdont|iƒƒ}|d |ds; s(RtlistRR‰tget_sizet reset_matrixtset_interpolationtresizet get_size_outtgetattrR=R,R6R+t cStringIOtStringIOt flipud_outt as_rgba_strRt write_pngtbase64t encodestringtgetvalueR/RJR.Rtreport(R8RyRztimtbboxRERxR—ttransstrtnumrowstnumcolsR|R{R°tstringiotrowstcolstbuffertfilename((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt draw_image0sH     2    #&   c C sú|o!|i||||||ƒdS|i|ƒ}|i|ddtƒ||iƒd8}|iƒ} t|iƒd ƒ} |ii } t doÒg} x>|D]6} |i || ƒ}|dj o| i |ƒq§q§Wt| ƒo3| dƒx| D]}| |ƒqÿW| dƒng}|i|ƒ}|dj o|i d|ƒn|i d | |iƒfƒ|d jo|i d ||| fƒn6|d jp |d jo|i d ||fƒn|i d | |iƒ|iƒ}d}d }x%|D]} |i|| ƒ}t| ƒ}|i|ƒ}|djotdƒ}d }n|i|dtƒ}|dj o|i||tƒ}nd }||d|i| 7}|i d|ƒ|d jo |i d||i| ƒn|i dƒ||id|i| 7}|}q W|i dƒ|dj o|i dƒndi|ƒ}nt|ƒ}|i}|iƒ}d| ||| |iƒf}|d jo d||| | | f}nd}dtƒ}| |ƒdS(NgtflagsgP@issvg.embed_char_pathss s s s, t?s gð@s R;sEfont-size: %f; font-family: %s; font-style: %s; fill: %s; opacity: %fs;transform="translate(%f,%f) rotate(%1.1f) translate(%f,%f)"sM%(thetext)s (t_draw_mathtextRTtset_textRt get_descentRMR RWR,R6Rt _add_char_defR=R…RŠR<Rkt FONT_SCALEt get_charmapt_get_char_def_idtordRJt load_chart get_kerningRtlinearHoriAdvanceRftescape_xml_textt family_namet get_styleRv(R8RBRyRzR}ROtangletismathRQtfontsizetcolorR6t new_charstcRbtsvgRDtcmaptlastgindtcurrxtcharnumtccodetgindtglyphtkerntthetextt fontfamilyt fontstyleRFR‚((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt draw_text_sŠ                          c C s¸t|tƒo|iƒ}|i|ƒ}n|}|i|idƒ|iƒd}tid|t |ƒfƒ}|i i |dƒ}|dj odSg}|i t |ƒdtƒ} d\} } x›| iD]} | ddjo$|id| d| d  fƒn+| ddjo,|id | d| | d  | fƒnî| dd joC|id | d| | d  | | d | | d  | fƒnš| dd joZ|id| d| | d  | | d | | d  | | d| | d | fƒn/| dd jo|idƒd\} } n| dd jo| d| d } } qÕqÕWdi|ƒ}dt|ƒiƒ}d|di|ƒf} ||i |<| S(NiHiiis%s-%dRÎgsM%f %fisl%f %fs q%f %f %f %fiisc%f %f %f %f %f %fiR„iþÿÿÿiÿÿÿÿR;sc_%ss (iiii(gg(gg(t isinstanceRtcopyRTRNRÔtget_sfntturllibtquoteR×R1RJR=RØRRbR…RfRRX(R8ROtchartnewpropRQtps_nametchar_idtchar_numR`RëRçtcurrytstept path_element((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyRÓ´sP      # # #  cC s‚t|tƒo|iƒ}|i|ƒ}n|}|i|idƒ|iƒd}tid|t |ƒfƒ}|i |S(NiHiiis%s-%d(iiii( RñRRòRTRNRÔRóRôRõR×R1(R8RORöR÷RQRøRù((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyRÖàs c!C s'|ii|d|ƒ\}}} } } | i} | i} t|iƒd ƒ}|ii}d|}tdoag}xP| D]H\}}}}}}|i ||ƒ}|dj o|i |ƒq}q}Wt |ƒo3|dƒx|D]}||ƒqçW|dƒnd|g}|djo|i d ||| fƒn|i d ||fƒ|i d ƒxW| D]O\}}}}}}|i ||ƒ}|i d ||| ||ifƒqmW|i d ƒn^d|||fg}|djo'|i d||| | | fƒn|i dƒd \}}xê| D]â\}}}}}}| }d||if}|i d|ƒ|i}|i d|ƒ||}|djo|i d|ƒn||} | djo|i d| ƒnt|ƒ}|i d|ƒ||}|}q;W|i dƒt | ƒo»d|}|i d|ƒ|djo|i d||| fƒn|i d ||fƒ|i d ƒx<| D]4\}}}}|i d|| |||fƒq­W|i dƒn|idƒ|di|ƒƒ|idƒdS(!s: Draw math text using matplotlib.mathtext iHisfill: %sssvg.embed_char_pathss s s s> s s gsfont-size: %f; font-family: %ss%s s sfill: %s; stroke: nonestranslate(%f,%f) rotate(%1.1f)sHstmathtextR;N(gg(R5tparset svg_glyphst svg_rectsR RWR,R6RRÓR=R…RŠRÖRÔRÜtadvanceRÛRRfR€(!R8RBRyRzR}RORÞR*R+tdescentt svg_elementstused_charactersRRRáR6RFRâRQRàRítnew_xt new_y_mtctmetricsRbRätcharidtcurr_xtcurr_ytnew_ytxadvancetdxtdy((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyRÐësŒ'                                & cC s|ii}|dƒdS(Ns (R,R6(R8R6((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pytfinalizeGs cC stS(N(tTrue(R8((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pytflipyKscC s|i|ifS(N(R*R+(R8((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pytget_canvas_width_heightNsc C sª|o5|ii|d|ƒ\}}}}}|||fS|i|ƒ} | i|ddtƒ| iƒ\} } | d} | d} | iƒ} | d} | | | fS(NiHgRÎgP@(R5RÿRTRÑRtget_width_heightRÒ( R8R}RORßR*R+RttrashRRQR{R|R¬((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pytget_text_width_height_descentQs'    N($t__name__t __module__RÔR RIR=R:RGRTRcR?R<RR€RRtMOVETOtLINETOtCURVE3tCURVE4R†RtR”RYR’RšR±RÍRðRÓRÖRÐRRRR(((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyR(%s<      &            &/ U , \   RcB sCeZhdd6dd6Zd„Zd„Zdd„Zd„ZRS(sScalable Vector GraphicsRätsvgzcO sut|ƒoti|ddƒ}}n6t|ƒoti|dƒ}d}n tdƒ‚|i||||S(NR{sutf-8s-filename must be a path or a file-like object(R tcodecstopenR t EncodedFileR=t ValueErrort _print_svg(R8RÌRRt fh_to_closeR9((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt print_svgds    cO s—t|ƒo,ti|dƒ}ti|dƒ}}nLt|ƒo2tid|ddƒ}}ti|dƒ}n tdƒ‚|i|||ƒS(NR{sutf-8tfileobjtmodes-filename must be a path or a file-like object(R tgziptGzipFileRR R R!R"(R8RÌRRt gzipwriterR#R9((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt print_svgzns   c K sß|iidƒ|iiƒ\}}|d|d}}tdot||||ƒ} nId} |iddƒ} t|i||| t||||ƒd| ƒ} |ii| ƒ| i ƒ|dj o|i ƒndS(NgR@iHssvg.image_noscaletbbox_inches_restore( tfiguretset_dpitget_size_inchesRR(RR=R tdrawRtclose( R8RÌR9R#RR*R+R{R|trenderert image_dpit_bbox_inches_restore((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyR"ys      cC sdS(NRä((R8((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pytget_default_filetype”sN(RRt filetypesR$R*R=R"R4(((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyR`s    RcB seZRS((RR(((sE/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyR—ssx (8���t ���__future__R����t���osR��R¿���t���tempfileRô���R'��Rº���t���hashlibR���t ���ImportErrort ���matplotlibR���R���R���t���matplotlib.backend_basesR���R���R���R���t!���matplotlib.backends.backend_mixedR ���t���matplotlib.cbookR ���R ���R ���t���matplotlib.colorsR ���t���matplotlib.figureR���t���matplotlib.font_managerR���R���t���matplotlib.ft2fontR���R���R���t���matplotlib.mathtextR���t���matplotlib.pathR���t���matplotlib.transformsR���R���t���xml.sax.saxutilsR���RÛ���t���backend_versionR#���Ri���R(���R���R���t ���FigureManagerR7���(����(����(����sE���/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_svg.pyt������s8���T" ÿ�ÿ�=7