)Uc@sdZddlZddlZddlmZmZddlmZmZm Z ddl m Z m Z m Z mZmZddlZddlZddlmZddlmZddlmZdd lmZmZdd lmZdd lmZm Z m!Z!m"Z"dd l#m$Z$m%Z%m&Z&dd l'm(Z(m)Z)ddl*j Z ddlm+Z+ddl,m-Z-e+j.j/de%dfdYZ0defdYZ1dZ2e+j.j/dej3e1dS(s5 The figure module provides the top-level :class:`~matplotlib.artist.Artist`, the :class:`Figure`, which contains all the plot elements. The following classes are defined :class:`SubplotParams` control the default spacing of the subplots :class:`Figure` top level container for all plot elements iN(tArtisttallow_rasterization(tAxest SubplotBasetsubplot_class_factory(tflattentallequaltStacktiterabletis_string_like(t FigureImage(trcParams(t Rectangle(tTextt_process_text_args(tLegend(tAffine2DtBboxtBboxTransformTotTransformedBbox(tprojection_factorytget_projection_namestget_projection_class(tBlockingMouseInputtBlockingKeyMouseInput(t docstring(t itemgettertprojection_namest SubplotParamscBsMeZdZdddddddZdddddddZdZRS(s6 A class to hold the parameters for a subplot cCs)t|_|j||||||dS(s All dimensions are fraction of the figure width or height. All values default to their rc params The following attributes are available *left* = 0.125 the left side of the subplots of the figure *right* = 0.9 the right side of the subplots of the figure *bottom* = 0.1 the bottom of the subplots of the figure *top* = 0.9 the top of the subplots of the figure *wspace* = 0.2 the amount of width reserved for blank space between subplots *hspace* = 0.2 the amount of height reserved for white space between subplots *validate* make sure the params are in a legal state (*left*<*right*, etc) N(tTruetvalidatetupdate(tselftlefttbottomtrightttoptwspacethspace((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt__init__,s csMtdd tdd tdd tdd tdd tdd jd|jd|jd|jd|jd|jd|fd}jrIjjkr|tdnjjkrI|td qInd S( s Update the current values. If any kwarg is None, default to the current value, if set, otherwise to rc R!R#R$R"R%R&cs:______dS(N(R!R#R$R"R%R&((R t thisbottomt thishspacetthisleftt thisrighttthistopt thiswspace(sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytreset^s      sleft cannot be >= rightsbottom cannot be >= topN( tgetattrtNonet _update_thisRR!R#t ValueErrorR"R$(R R!R"R#R$R%R&R.((R R(R)R*R+R,R-sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRGs(! cCsX|dkrDt||d}|dkrDd|}t|}qDnt|||dS(Nsfigure.subplot.(R0R/R tsetattr(R tstvaltkey((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyR1qs    N(t__name__t __module__t__doc__R0R'RR1(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyR(s   )tFigurec BsWeZdZdZd:d:d:d:ded:dZdZdZe eeZ dddd Z d Z d Z d Zd ZdZd:dZddd:d:d:d:d:d:dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ d Z!d!Z"e#j$d"Z%e#j$d#Z&e'd$Z(d%Z)e*d&Z+d'Z,d(Z-d)Z.e#j$d*Z/d+Z0e#j$d,Z1d-Z2d.Z3d/Z4d0Z5e#j$d:d:d1Z6d2Z7d3ded3d4d5d6Z8d7d8Z9d9Z:RS(;s The Figure instance supports callbacks through a *callbacks* attribute which is a :class:`matplotlib.cbook.CallbackRegistry` instance. The events you can connect to are 'dpi_changed', and the callback will be called with ``func(fig)`` where fig is the :class:`Figure` instance. The figure patch is drawn by a the attribute *patch* a :class:`matplotlib.patches.Rectangle` instance *suppressComposite* for multiple figure images, the figure will make composite images depending on the renderer option_image_nocomposite function. If suppressComposite is True|False, this will override the renderer cCsdt|jjS(Ns Figure(%gx%g)(ttupletbboxtsize(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt__str__sg?c Cstj|tjd|_|dkr8td}n|dkrQtd}n|dkrjtd}n|dkrtd}nt|_||_ t j dd||_ t |j |j|_||_t|j|_tdddd d d d |d |d ||_|_|j|jtd|_d|_|dkrXt}n||_t|_g|_|jd|_dS(s& *figsize* w,h tuple in inches *dpi* dots per inch *facecolor* the figure patch facecolor; defaults to rc ``figure.facecolor`` *edgecolor* the figure patch edge color; defaults to rc ``figure.edgecolor`` *linewidth* the figure patch edge linewidth; the default linewidth of the frame *frameon* if False, suppress drawing the figure frame *subplotpars* a :class:`SubplotParams` instance, defaults to rc t dpi_changedsfigure.figsizes figure.dpisfigure.facecolorsfigure.edgecoloritxytwidthitheightt facecolort edgecolort linewidths axes.holdN(R?(ii(RR'tcbooktCallbackRegistryt callbacksR0R Rtdpi_scale_transtdpiRt from_boundst bbox_inchesRR<tframeonRt transFigureR tpatcht figurePatcht_set_artist_propst_holdtcanvasRt subplotparsRt_axstacktaxestclft_cachedRenderer(R tfigsizeRJRCRDRERMRT((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyR's<                 cCs|jS(N(t_dpi(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt_get_dpiscCs9||_|jjj|||jjd|dS(NR?(RZRItcleartscaleRHtprocess(R RJ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt_set_dpis g?iR#cCs%tjg|jD]}t|d^q}t|jdkrwx|jD] }|j||j|qPWn|rx|jD]w}|j rxb|jD] }|j||j|qWqx!|jD]}|j t qW|j dqWn|r!|j d|ndS(s] Date ticklabels often overlap, so it is useful to rotate them and right align them. Also, a common use case is a number of subplots with shared xaxes where the x-axis is date data. The ticklabels are often long, and it helps to rotate them on the bottom subplot and turn them off on other subplots, as well as turn off xlabels. *bottom* the bottom of the subplots for :meth:`subplots_adjust` *rotation* the rotation of the xtick labels *ha* the horizontal alignment of the xticklabels t is_last_rowitR"N(tnptalltrueRVthasattrtlentget_xticklabelstset_hat set_rotationtget_axesR`t set_visibletFalset set_xlabeltsubplots_adjust(R R"trotationthataxt allsubplotstlabel((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt autofmt_xdates .   cCs|jg}|j|j|j|j|j|j|j|j|j|j|j|j|j|j|S(s-get a list of artists contained in the figure( ROtextendtartistsRVtlinestpatchesttextstimagestlegends(R tchildren((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt get_childrens cCsDt|jr|j||S|jj|j|j}|ifS(s_ Test whether the mouse event occurred on the figure. Returns True,{} (tcallablet _containsR<tcontainstxty(R t mouseeventtinside((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyR scOs|jS(s=get the figure bounding box in display space; kwargs are void(R<(R targstkwargs((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytget_window_extentscKs|jdd}|jdd}d|krId|krId|dscCs)|dkr|j |_n ||_dS(s  Set the hold state. If hold is None (default), toggle the hold state. Else set the hold state to boolean value b. Eg:: hold() # toggle hold hold(True) # hold is on hold(False) # hold is off N(R0RR(R tb((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytholdFs ic Ks|js|jnt|||||| | } | j|| j||dkrm| j||n|jj| | S(s call signatures:: figimage(X, **kwargs) adds a non-resampled array *X* to the figure. :: figimage(X, xo, yo) with pixel offsets *xo*, *yo*, *X* must be a float array: * If *X* is MxN, assume luminance (grayscale) * If *X* is MxNx3, assume RGB * If *X* is MxNx4, assume RGBA Optional keyword arguments: ========= ========================================================== Keyword Description ========= ========================================================== xo or yo An integer, the *x* and *y* image offset in pixels cmap a :class:`matplotlib.cm.ColorMap` instance, eg cm.jet. If None, default to the rc ``image.cmap`` value norm a :class:`matplotlib.colors.Normalize` instance. The default is normalization(). This scales luminance -> 0-1 vmin|vmax are used to scale a luminance image to 0-1. If either is None, the min and max of the luminance values will be used. Note if you pass a norm instance, the settings for *vmin* and *vmax* will be ignored. alpha the alpha blending value, default is None origin [ 'upper' | 'lower' ] Indicates where the [0,0] index of the array is in the upper left or lower left corner of the axes. Defaults to the rc image.origin value ========= ========================================================== figimage complements the axes image (:meth:`~matplotlib.axes.Axes.imshow`) which will be resampled to fit the current axes. If you want a resampled image to fill the entire figure, you can define an :class:`~matplotlib.axes.Axes` with size [0,1,0,1]. An :class:`matplotlib.image.FigureImage` instance is returned. .. plot:: mpl_examples/pylab_examples/figimage_demo.py Additional kwargs are Artist kwargs passed on to :class:`~matplotlib.image.FigureImage` N( RRRWR t set_arrayt set_alphaR0tset_climRytappend( R tXtxotyotalphatnormtcmaptvmintvmaxtoriginRtim((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytfigimageTs@    c Os|jdt}t|dkr7|d\}}n |\}}|j}||f|j_|r|j}||}||}t|jdd} | dk r| j t |t |qndS(s set_size_inches(w,h, forward=False) Set the figure size in inches Usage:: fig.set_size_inches(w,h) # OR fig.set_size_inches((w,h) ) optional kwarg *forward=True* will cause the canvas size to be automatically updated; eg you can resize the figure window from the shell ACCEPTS: a w,h tuple with w,h in inches tforwardiitmanagerN( tgetRkReRJRLtp1R/RSR0tresizetint( R RRRtwthtdpivaltcanvaswtcanvashR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytset_size_inchess      cCs |jjS(N(RLR(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytget_size_inchesscCs |jjS(s*Get the edge color of the Figure rectangle(ROt get_edgecolor(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRscCs |jjS(s*Get the face color of the Figure rectangle(ROt get_facecolor(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRscCs |jjS(sReturn the figwidth as a float(RLRA(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt get_figwidthscCs |jjS(sReturn the figheight as a float(RLRB(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt get_figheightscCs|jS(sReturn the dpi as a float(RJ(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytget_dpiscCs|jS(s"get the boolean indicating frameon(RM(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt get_frameonscCs|jj|dS(sv Set the edge color of the Figure rectangle ACCEPTS: any matplotlib color - see help(colors) N(ROt set_edgecolor(R tcolor((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRscCs|jj|dS(sv Set the face color of the Figure rectangle ACCEPTS: any matplotlib color - see help(colors) N(ROt set_facecolor(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRscCs ||_dS(sM Set the dots-per-inch of the figure ACCEPTS: float N(RJ(R R5((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytset_dpiscCs||j_dS(sO Set the width of the figure in inches ACCEPTS: float N(RLtx1(R R5((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt set_figwidthscCs||j_dS(sP Set the height of the figure in inches ACCEPTS: float N(RLty1(R R5((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt set_figheightscCs ||_dS(so Set whether the figure frame (background) is displayed or invisible ACCEPTS: boolean N(RM(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt set_frameonscCs|jj||jj|g}x6|jjD]%\}}||kr6|j|=q6q6Wx|jD]}||qiWdS(s4remove a from the figure and update the current axesN(RVtremoveRUt_seentitemst _axobservers(R tatkeysR6tthisaxtfunc((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytdelaxes s cOs4d}d}||||jf}|S(s*make a hashable key out of args and kwargscSsUg}xB|D]:\}}t|r4t|}n|j||fq Wt|S(N(RR;R(Rtrettktv((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytfixitemss  cSsIg}x6|D].}t|r.t|}n|j|q Wt|S(N(RR;R(RRR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytfixlist#s   (R(R RRRRR6((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt _make_keys c OsF|j||}||jkr?|j|}|j||St|sOdSt|dtr|d}|j|kstn|d}|jdt }|jdd}|r|dk r|dkrt dd|nd}nt ||||}|j j||jj||j|||j|<|S(sW Add an a axes with axes rect [*left*, *bottom*, *width*, *height*] where all quantities are in fractions of figure width and height. kwargs are legal :class:`~matplotlib.axes.Axes` kwargs plus *projection* which sets the projection type of the axes. (For backward compatibility, ``polar=True`` may also be provided, which is equivalent to ``projection='polar'``). Valid values for *projection* are: %(projection_names)s. Some of these projections support additional kwargs, which may be provided to :meth:`add_axes`:: rect = l,b,w,h fig.add_axes(rect) fig.add_axes(rect, frameon=False, axisbg='g') fig.add_axes(rect, polar=True) fig.add_axes(rect, projection='polar') fig.add_axes(ax) # add an Axes instance If the figure already has an axes with the same parameters, then it will simply make that axes current and return it. If you do not want this behavior, eg. you want to force the creation of a new axes, you must use a unique set of args and kwargs. The axes :attr:`~matplotlib.axes.Axes.label` attribute has been exposed for this purpose. Eg., if you want two axes that are otherwise identical to be added to the figure, make sure you give them unique labels:: fig.add_axes(rect, label='axes1') fig.add_axes(rect, label='axes2') The :class:`~matplotlib.axes.Axes` instance will be returned. The following kwargs are supported: %(Axes)s Nitpolart projections!polar=True, yet projection='%s'. s/Only one of these arguments should be supplied.(RRtscaRet isinstanceRt get_figuretAssertionErrorRRkR0R2RRVRRUtpush( R RRR6RpRtrecttispolarR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytadd_axes-s4'        c Os|j}t|sdSt|dtrT|d}|j|ksXtn|jdt}|jdd}|r|dk r|dkrt dd|nd}nt |}|j ||}||j kr3|j |}t||r|j ||S|jj||jj|nt||||}||j |<|jj||jj||j ||S(sO Add a subplot. Examples: fig.add_subplot(111) fig.add_subplot(1,1,1) # equivalent but more general fig.add_subplot(212, axisbg='r') # add subplot with red background fig.add_subplot(111, polar=True) # add a polar subplot fig.add_subplot(sub) # add Subplot instance sub *kwargs* are legal :class:`!matplotlib.axes.Axes` kwargs plus *projection*, which chooses a projection type for the axes. (For backward compatibility, *polar=True* may also be provided, which is equivalent to *projection='polar'*). Valid values for *projection* are: %(projection_names)s. Some of these projections support additional *kwargs*, which may be provided to :meth:`add_axes`. The :class:`~matplotlib.axes.Axes` instance will be returned. If the figure already has a subplot with key (*args*, *kwargs*) then it will simply make that subplot current and return it. The following kwargs are supported: %(Axes)s NiRRs!polar=True, yet projection='%s'. s/Only one of these arguments should be supplied.(tcopyReRRRRRRkR0R2RRRRRVRRURRR( R RRRRRtprojection_classR6Rp((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt add_subplotss<         cCsd|_tjd|_x.t|jD]}|j|j|q+Wt |j dd}|dk rz|j n|j j i|_g|_g|_g|_g|_g|_g|_|sg|_ndS(s Clear the figure. Set *keep_observers* to True if, for example, a gui widget is tracking the axes in the figure. R?ttoolbarN(s dpi_changed(R0tsuppressCompositeRFRGRHR;RVtclaRR/RSRRUR\RRuRvRwRxRyRzR(R tkeep_observersRpR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRWs$            cCs|jdS(s9 Clear the figure -- synonym for fig.clf N(RW(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyR\sc sPjsdSjdjr9jjng}x3jD](}|j|j|jgfqIWx3jD](}|j|j|jgfqWx3j D](}|j|j|jgfqWj }j dk rj }nt jdksI|sItgjD]j^q0 rxjD](}|j|j|jgfqSWnj}gjD]$j|jjf^q}tjjj|jj||t_jj\}}fd} |jjdj| gfx3jD](}|j|j|jgfqTWx3jD](}|j|j|jgfqWx3jD](}|j|j|jgfqW|j dt!dx!|D]\} } } | | q Wj"d_#j$j%dS(sj Render the figure using :class:`matplotlib.backend_bases.RendererBase` instance renderer NtfigureicsSj}|jj|jjj||jdS(N(tnew_gctset_clip_rectangleR<t set_clip_patht get_clip_patht draw_imagetrestore(tgc(RRtltrendererR (sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytdraw_composites  iR6(&t get_visiblet open_groupRMROtdrawRwRt get_zorderRvRutoption_image_nocompositeRR0ReRyRRtget_image_magnificationt make_imagetoxtoyt_imaget from_imagesR<RBRARkt is_grayscaletboundsRVRxRztsortRt close_groupRXRSt draw_event( R RtdsuRt not_compositetmagtimsRRRtzorderRR((RRRRR sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRsR   &&&  &) 1   #&&&  cCs)|jdk st|j|jdS(s draw :class:`matplotlib.artist.Artist` instance *a* only -- this is available only after the figure is drawn N(RXR0RR(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt draw_artist&scCs|jS(N(RV(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRi.scOs8t|}t|||||}|jj||S(s2 Place a legend in the figure. Labels are a sequence of strings, handles is a sequence of :class:`~matplotlib.lines.Line2D` or :class:`~matplotlib.patches.Patch` instances, and loc can be a string or an integer specifying the legend location USAGE:: legend( (line1, line2, line3), ('label1', 'label2', 'label3'), 'upper right') The *loc* location codes are:: 'best' : 0, (currently not supported for figure legends) '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, *loc* can also be an (x,y) tuple in figure coords, which specifies the lower left of the legend box. figure coords are (0,0) is the left, bottom of the figure and 1,1 is the right, top. Keyword arguments: *prop*: [ None | FontProperties | dict ] A :class:`matplotlib.font_manager.FontProperties` instance. If *prop* is a dictionary, a new instance will be created with *prop*. If *None*, use rc settings. *numpoints*: integer The number of points in the legend line, default is 4 *scatterpoints*: integer The number of points in the legend line, default is 4 *scatteroffsets*: list of floats a list of yoffsets for scatter symbols in legend *markerscale*: [ None | scalar ] The relative size of legend markers vs. original. If *None*, use rc settings. *fancybox*: [ None | False | True ] if True, draw a frame with a round fancybox. If None, use rc *shadow*: [ None | False | True ] If *True*, draw a shadow behind legend. If *None*, use rc settings. *ncol* : integer number of columns. default is 1 *mode* : [ "expand" | None ] if mode is "expand", the legend will be horizontally expanded to fill the axes area (or *bbox_to_anchor*) *title* : string the legend title Padding and spacing between various elements use following keywords parameters. The dimensions of these values are given as a fraction of the fontsize. Values from rcParams will be used if None. ================ ================================================================== Keyword Description ================ ================================================================== borderpad the fractional whitespace inside the legend border labelspacing the vertical space between the legend entries handlelength the length of the legend handles handletextpad the pad between the legend handle and text borderaxespad the pad between the axes and legend border columnspacing the spacing between columns ================ ================================================================== **Example:** .. plot:: mpl_examples/pylab_examples/figlegend_demo.py (RRRzR(R thandlestlabelsRRR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytlegend1sY cOs[ti||}td|d|d|}|j||j||jj||S(sT Call signature:: figtext(x, y, s, fontdict=None, **kwargs) Add text to figure at location *x*, *y* (relative 0-1 coords). See :func:`~matplotlib.pyplot.text` for the meaning of the other arguments. kwargs control the :class:`~matplotlib.text.Text` properties: %(Text)s RRR(RR RRQRxR(R RRR4RRtoverrideR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRs  cCs0||kr|j|n|j|jdS(N(t set_figuret set_transformRN(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRQs cKs|j}|dk r|jdt}|jdd}|rz|dk rq|dkrqtdd|nd}nt|}t||r|Sn|jd|S(s Return the current axes, creating one if necessary The following kwargs are supported %(Axes)s RRs!polar=True, yet projection='%s'. s/Only one of these arguments should be supplied.ioN(RUR0RRkR2RRR(R RRpRRR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytgcas    cCs2|jj|x|jD]}||qW|S(s)Set the current axes to be a and return a(RUtbubbleR(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRscCs:x3t|jD]"}|j}|dk r|SqWdS(sZ helper for :func:`~matplotlib.pyplot.gci`; do not use elsewhere. N(treversedRUt_gciR0(R RpR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRs   cCs|jj|dS(s9whenever the axes state change, func(self) will be calledN(RR(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytadd_axobserversc Os|jdtdtd}|rvt|drvd|dkrv|dkrv|dd|}|f|d}n|jdt}|r |jd d |jd d g}x~|jD]H}|j}|j|j|j f|j d |j d qWn(|jd td |jd td |j j |||rxKt|j|D]4\}} |jj | d|jj | dqaWndS(s call signature:: savefig(fname, dpi=None, facecolor='w', edgecolor='w', orientation='portrait', papertype=None, format=None, transparent=False, bbox_inches=None, pad_inches=0.1): Save the current figure. The output formats available depend on the backend being used. Arguments: *fname*: A string containing a path to a filename, or a Python file-like object, or possibly some backend-dependent object such as :class:`~matplotlib.backends.backend_pdf.PdfPages`. If *format* is *None* and *fname* is a string, the output format is deduced from the extension of the filename. If the filename has no extension, the value of the rc parameter ``savefig.extension`` is used. If that value is 'auto', the backend determines the extension. If *fname* is not a string, remember to specify *format* to ensure that the correct backend is used. Keyword arguments: *dpi*: [ None | scalar > 0 ] The resolution in dots per inch. If *None* it will default to the value ``savefig.dpi`` in the matplotlibrc file. *facecolor*, *edgecolor*: the colors of the figure rectangle *orientation*: [ 'landscape' | 'portrait' ] not supported on all backends; currently only on postscript output *papertype*: One of 'letter', 'legal', 'executive', 'ledger', 'a0' through 'a10', 'b0' through 'b10'. Only supported for postscript output. *format*: One of the file extensions supported by the active backend. Most backends support png, pdf, ps, eps and svg. *transparent*: If *True*, the axes patches will all be transparent; the figure patch will also be transparent unless facecolor and/or edgecolor are specified via kwargs. This is useful, for example, for displaying a plot on top of a colored background on a web page. The transparency of these patches will be restored to their original values upon exit of this function. *bbox_inches*: Bbox in inches. Only the given portion of the figure is saved. If 'tight', try to figure out the tight bbox of the figure. *pad_inches*: Amount of padding around the figure when bbox_inches is 'tight'. *bbox_extra_artists*: A list of extra artists that will be considered when the tight bbox is calculated. RJs savefig.dpissavefig.extensionit.tautoit transparentRCtnoneRDssavefig.facecolorssavefig.edgecolorN(t setdefaultR R RRkRVRORRRRRRSt print_figuretzip( R RRt extensiontfnameR toriginal_axes_colorsRpROtcc((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytsavefigs.I 2  c s|dkr|j}n|dkrBtj||\}}n|jttj|||fd}|jjd||_ |j ||j |S(s Create a colorbar for a ScalarMappable instance. Documentation for the pylab thin wrapper: %(colorbar_doc)s cs7j|jj|jj|dS(N(tset_cmaptget_cmapRtget_climt update_normal(tm(tcb(sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt on_changedRstchangedN( R0Rtcbart make_axesRRtColorbart callbacksSMtconnecttcbidt set_colorbarR(R tmappabletcaxRptkwR((RsD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytcolorbarCs    cOs|jj||ddl}x|jD]}t||jjs|jdk rt|j|jjr|jj|j |jj q|j dk rt|j |jjr|j j|j |j j qq)|j|j |j q)WdS(s fig.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None) Update the :class:`SubplotParams` with *kwargs* (defaulting to rc where None) and update the subplot locations iN( RTRtmatplotlib.axesRVRRt_sharexR0t update_paramst set_positiontfigboxt_sharey(R RRt matplotlibRp((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyRm]s  ' '  iiicCs7t|d|d|d|}|d|d|d|S(s call signature:: ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1, mouse_pop=3, mouse_stop=2) Blocking call to interact with the figure. This will wait for *n* clicks from the user and return a list of the coordinates of each click. If *timeout* is zero or negative, does not timeout. If *n* is zero or negative, accumulate clicks until a middle click (or potentially both mouse buttons at once) terminates the input. Right clicking cancels last input. The buttons used for the various actions (adding points, removing points, terminating the inputs) can be overriden via the arguments *mouse_add*, *mouse_pop* and *mouse_stop*, that give the associated mouse button: 1 for left, 2 for middle, 3 for right. The keyboard can also be used to select points in case your mouse does not have one or more of the buttons. The delete and backspace keys act like right clicking (i.e., remove last point), the enter key terminates input and any other key (not already used by the window manager) selects a point. t mouse_addt mouse_popt mouse_stoptnttimeoutt show_clicks(R(R R2R3R4R/R0R1tblocking_mouse_input((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytginputus  icCst|}|d|S(sd call signature:: waitforbuttonpress(self, timeout=-1) Blocking call to interact with the figure. This will return True is a key was pressed, False if a mouse button was pressed and None if *timeout* was reached without either being pressed. If *timeout* is negative, does not timeout. R3(R(R R3tblocking_input((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pytwaitforbuttonpresss cCsg}x6|jD]+}|jr|j|j|qqWtjg|D]*}|jdksp|jdkrL|^qL}t|t j d|j }|S(s Return a (tight) bounding box of the figure in inches. It only accounts axes title, axis labels, and axis ticklabels. Needs improvement. ig?( RVRRt get_tightbboxRtunionRARBRRR]RJ(R RtbbRpRt_bboxRL((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyR9s @N(;R7R8R9R>R0RR'R[R_tpropertyRJRsR|RRRRRRRRRRRRRRRRRRRRRRRtdedent_interpdRRRkRWR\RRRRiRRRQRRRRRR'RmR6R8R9(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyR:zs  9  $  $   B #              FC  N   ^    f & c Cst|d}tjd }tjd }|rY|jd \}}t||}n t|}tdd}tj|||f}|td||:}|td||:}tj|||}|S( s; Create a figure with specified aspect ratio. If *arg* is a number, use that aspect ratio. If *arg* is an array, figaspect will determine the width and height for a figure that would fit array preserving aspect ratio. The figure width, height in inches are returned. Be sure to create an axes with equal with and height, eg Example usage:: # make a figure twice as tall as it is wide w, h = figaspect(2.) fig = Figure(figsize=(w,h)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8]) ax.imshow(A, **kwargs) # make a figure with the proper aspect for an array A = rand(5,3) w, h = figaspect(A) fig = Figure(figsize=(w,h)) ax = fig.add_axes([0.1, 0.1, 0.8, 0.8]) ax.imshow(A, **kwargs) Thanks to Fernando Perez for this function tshapeg@g@g0@isfigure.figsizeig?(g@g@(g0@g0@( RdRbtarrayR?tfloatR tmintmaxtclip( targtisarrayt figsize_mint figsize_maxtnrtnct arr_ratiot fig_heighttnewsize((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt figaspects (4R9tnumpyRbtartistRRRVRRRRFRRRRR RR'RtimageR R.R RwR RR RRRt transformsRRRRt projectionsRRRtmatplotlib.blocking_inputRRtmatplotlib.cbookRtoperatorRtinterpdRRR:RNtkwdoc(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/figure.pyt s6  (  "RO >