}+zJc@sdZddkiZddklZddkZddkZde fdYZ de fdYZ de fd YZ d e fd YZ d dd YZhZdZddklZeeZdZdZdZdZedjoeendS(s The axes_divider module provide helper classes to adjust the positions of multiple axes at the drawing time. Divider: this is the class that is used calculates the axes position. It divides the given renctangular area into several sub rectangles. You intialize the divider by setting the horizontal and vertical list of sizes that the division will be based on. You then use the new_locator method, whose return value is a callable object that can be used to set the axes_locator of the axes. iN(t SubplotBasetDividercBseZdZdddZedZedZdZdZ dZ dZ d Z d Z d Zd Zed ZdZddddZdddZRS(s This is the class that is used calculates the axes position. It divides the given renctangular area into several sub-rectangles. You intialize the divider by setting the horizontal and vertical lists of sizes (:mod:`mpl_toolkits.axes_grid.axes_size`) that the division will be based on. You then use the new_locator method to create a callable object that can be used to as the axes_locator of the axes. tCcCsL||_||_||_||_||_||_d|_d|_dS(s :param fig: matplotlib figure :param pos: position (tuple of 4 floats) of the rectangle that will be divided. :param horizontal: list of sizes (:mod:`~mpl_toolkits.axes_grid.axes_size`) for horizontal division :param vertical: list of sizes (:mod:`~mpl_toolkits.axes_grid.axes_size`) for vertical division :param aspect: if True, the overall rectalngular area is reduced so that the relative part of the horizontal and vertical scales have same scale. :param anchor: Detrmine how the reduced rectangle is placed when aspect is True, iN(t_figt_post _horizontalt _verticalt_anchort_aspectt _xrefindext _yrefindex(tselftfigtpost horizontaltverticaltaspecttanchor((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt__init__$s       c Csnd\}}x7|D]/}|i|\}}||7}||7}qW|djo|||}|SdSdS(Ng(gg(tget_size( tlt total_sizetrenderertrs_sumtas_sumtst_rst_astk((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt_calc_k@s   cCsPdg}x@|D]8}|i|\}}|i|d|||qW|S(Ngi(Rtappend(RRRtoffsetsRRR((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt _calc_offsetsQs  !cCs ||_dS(s set the position of the rectangle. :param pos: position (tuple of 4 floats) of the rectangle that will be divided. N(R(R R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt set_position]scCs|iS(s%return the position of the rectangle.(R(R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt get_positionfscCsb|tiiijpt|djo ||_n&tdditiiidS(s :param anchor: anchor position ===== ============ value description ===== ============ 'C' Center 'SW' bottom left 'S' bottom 'SE' bottom right 'E' right 'NE' top right 'N' top 'NW' top left 'W' left ===== ============ isargument must be among %ss, N( t mtransformstBboxtcoefstkeystlenRt ValueErrortjointBBox(R R((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt set_anchorjs, cCs|iS(sreturn the anchor(R(R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt get_anchorscCs ||_dS(s :param horizontal: list of sizes (:mod:`~mpl_toolkits.axes_grid.axes_size`) for horizontal division N(R(R th((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pytset_horizontalscCs|iS(sreturn horizontal sizes(R(R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pytget_horizontalscCs ||_dS(s :param horizontal: list of sizes (:mod:`~mpl_toolkits.axes_grid.axes_size`) for horizontal division N(R(R tv((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt set_verticalscCs|iS(sreturn vertical sizes(R(R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt get_verticalscCs ||_dS(s. :param anchor: True or False N(R(R R((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt set_aspectscCs|iS(s return aspect(R(R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt get_aspectscCs |ii\}}|i\}} } } |i|i|| |} |i|i|| |} |iot| | }|i|i||}|i|i||}|d|d|}|d|d|}t i i || | | }t i i || ||}|i |i |}|i|i}}n>|i|i| |}|i|i| |}|| }}|djo|d}n|djo|d}n|||||||||}}|||||||||}}t i i ||||S(sT :param nx, nx1: Integers specifying the column-position of the cell. When nx1 is None, a single nx-th column is specified. Otherwise location of columns spanning between nx to nx1 (but excluding nx1-th column) is specified. :param ny, ny1: same as nx and nx1, but for row positions. iiiN(Rtget_size_inchesR"RRRR4tminR R#R$t from_boundstanchoredR,tx0ty0tNone(R tnxtnytnx1tny1RtfigWtfigHtxtytwR-tk_htk_vRtoxtoytwwthhtpbtpb1t pb1_anchoredR9R:tx1tw1ty1th1((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pytlocates0     ))cCst|||||S(s returns a new locator (:class:`mpl_toolkits.axes_grid.axes_divider.AxesLocator`) for specified cell. :param nx, nx1: Integers specifying the column-position of the cell. When nx1 is None, a single nx-th column is specified. Otherwise location of columns spanning between nx to nx1 (but excluding nx1-th column) is specified. :param ny, ny1: same as nx and nx1, but for row positions. (t AxesLocator(R R<R=R>R?((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt new_locators N(t__name__t __module__t__doc__R;Rt staticmethodRR R!R"R+R,R.R/R1R2tFalseR3R4RRRT(((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRs          /RScBs&eZdZdddZdZRS(s} A simple callable object, initiallized with AxesDivider class, returns the position and size of the given cell. cCs||_|i}|i}|||||_|_|djo|d}n|djo|d}n|||_|||_dS(s :param axes_divider: An instance of AxesDivider class. :param nx, nx1: Integers specifying the column-position of the cell. When nx1 is None, a single nx-th column is specified. Otherwise location of columns spanning between nx to nx1 (but excluding nx1-th column) is is specified. :param ny, ny1: same as nx and nx1, but for row positions. iN(t _axes_dividerR R t_nxt_nyR;t_nx1t_ny1(R t axes_dividerR<R=R>R?R R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRs      cCsP|ii}|ii}|ii|i||i||i||i||S(N(RZR R RRR[R\R]R^(R taxesRR R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt__call__ s     N(RURVRWR;RRa(((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRSstSubplotDividercBs)eZdZdZdZdZRS(sT The Divider class whose rectangle area is specified as a subplot grometry. c Os||_t|djoOt|d}t|djotdntt|\}}}n3t|djo|\}}}n td||}|d8}||jotdn||_||_||_|i |i i } |i dg} |i dg} |i d d } |i d d } |otd nti||| | | d | d | d S(s *fig* is a :class:`matplotlib.figure.Figure` instance. *args* is the tuple (*numRows*, *numCols*, *plotNum*), where the array of subplots in the figure has dimensions *numRows*, *numCols*, and where *plotNum* is the number of the subplot being created. *plotNum* starts at 1 in the upper left corner and increases to the right. If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*. iiis+Argument to subplot must be a 3 digits longsIllegal argument to subplots%Subplot number exceeds total subplotsRRRRRtN(tfigureR'tstrR(tmaptintt_rowst_colst_numt update_paramstfigboxtboundstpopR;t ExceptionRR(R R targstkwargsRtrowstcolstnumttotalR RRRR((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRs4          cCs|i|iiS(s$return the bounds of the subplot box(RkRlRm(R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyR"Rs cCs|i}|i}|i}|ii}|i}|i}|i}|i}|i } |i } ||} ||} | || |d} | | }| || |d}| |}t ||\}}||d| ||}||||}t i i|||| |_dS(s0update the subplot position from fig.subplotparsiN(RhRiRjRdt subplotparstlefttrighttbottomttoptwspacethspacetdivmodR#R$R7Rl(R RrRsRttparsRwRxRyRzR{R|ttotWidtht totHeightRAtsepHR@tsepWtrowNumtcolNumt figBottomtfigLeft((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRkXs*              (RURVRWRR"Rk(((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRbs 3 t AxesDividercBsYeZdZdZdZdedZdedZdZ dZ dZ RS( s1 Divider based on the pre-existing axes. cCst||_ti||_ti||_ti|d|iddd|igd|igdddddS( s# :param axes: axes R R RRRRRN( t_axestSizetAxesXt_xreftAxesYt_yrefRRt get_figureR;(R R`((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyR}s  cKs}|i}|idd}|djo-t|to |i}qUt|}n||i|idt |}|S(Nt axes_classtoriginal( RRnR;t isinstanceRt _axes_classttypeRR"tTrue(R RqR`Rtax((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt _get_new_axess    cKse|opt|tipti|d|i}n|o&|iid||id7_qw|ii|nt|tipti|d|i}n|o>|iid||id7_|i dddd}n6|ii||i dt |iddd}|i |}|i dt |iddd}|i ||S(s Add a new axes on the right (or left) side of the main axes. :param size: A width of the axes. A :mod:`~mpl_toolkits.axes_grid.axes_size` instance or if float or string is given, *from_any* fucntion is used to create one, with *ref_size* set to AxesX instance of the current axes. :param pad: pad between the axes. It takes same argument as *size*. :param pack_start: If False, the new axes is appended at the end of the list, i.e., it became the right-most axes. If True, it is inseted at the start of the list, and becomes the left-most axes. All extra keywords argument is passed to when creating a axes. if *axes_class* is given, the new axes will be created as an instance of the given class. Otherwise, the same class of the main axes will be used. if Not provided t fraction_refiiR<R=( RRt_Basetfrom_anyRRtinsertR RRTR'Rtset_axes_locator(R tsizetpadt pack_startRqtlocatorR((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pytnew_horizontals*  %% cKs@|opt|tipti|d|i}n|o&|iid||id7_qw|ii|nt|tipti|d|i}n|o>|iid||id7_|i dddd}n6|ii||i dddt |id}|i |}|i ||S(s Add a new axes on the top (or bottom) side of the main axes. :param size: A height of the axes. A :mod:`~mpl_toolkits.axes_grid.axes_size` instance or if float or string is given, *from_any* fucntion is used to create one, with *ref_size* set to AxesX instance of the current axes. :param pad: pad between the axes. It takes same argument as *size*. :param pack_start: If False, the new axes is appended at the end of the list, i.e., it became the top-most axes. If True, it is inseted at the start of the list, and becomes the bottom-most axes. All extra keywords argument is passed to when creating a axes. if *axes_class* is given, the new axes will be created as an instance of the given class. Otherwise, the same class of the main axes will be used. if Not provided RiiR<R=( RRRRRRRR RRTR'RR(R RRRRqRR((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyt new_verticals(  % cCsD|idjo)|ii}|djotStSn|iSdS(Ntauto(RR;RR4RYR(R R((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyR4s  cCs8|idjo|iidt}|iS|iSdS(NR(RR;RR"RRm(R tbbox((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyR"scCs)|idjo|iiS|iSdS(N(RR;RR,(R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyR, sN( RURVRWRRR;RYRRR4R"R,(((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRxs 00 tLocatableAxesBasecBs>eZdZdZdZddZdedZRS(cOs,|ii|||d|_d|_dS(N(RRR;t_locatort_locator_renderer(R tkltkw((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRs cCs ||_dS(N(R(R R((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRscCs|iS(N(R(R ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pytget_axes_locatorscCs\|idjo|ii||n/|i||i}|ii|d|dS(Ntposition(RR;Rt apply_aspectR(R RR ((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyR scCs#||_|ii|||dS(N(RRtdraw(R Rtinframe((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyR)s N( RURVRRRR;RRYR(((sI/usr/lib64/python2.6/site-packages/mpl_toolkits/axes_grid/axes_divider.pyRs     cCsWti|}|djo7tid|it|fh|d6}|t| s(  -_    X