ó ù)°Uc @ s dZddlmZddlZddlZddlmZmZddlmZddl m Z ddl m Z ddl mZdd lmZd efd „ƒYZd efd „ƒYZeedeeedeedded„ Ze jjd ejeƒƒdS(sG Place a table below the x-axis at location loc. The table consists of a grid of cells. The grid need not be rectangular and can have holes. Cells are added by specifying their row and column. For the purposes of positioning the cell at (0, 0) is assumed to be at the top left and the cell at (max_row, max_col) is assumed to be at bottom right. You can add additional cells outside this range to have convenient ways of positioning more interesting grids. Author : John Gill Copyright : 2004 John Gill and John Hunter License : matplotlib license iÿÿÿÿ(tdivisionN(tArtisttallow_rasterization(t Rectangle(tis_string_like(t docstring(tText(tBboxtCellcB s˜eZdZdZddedddd„Zd„Zd„Zd„Z d „Z d „Z d „Z e d „ƒZd „Zd„Zd„Zd„ZRS(s; A cell is a Rectangle with some associated text. gš™™™™™¹?tktwtc C s“tj||d|d|d|d|ƒ|jtƒ|dkrJd}n||_td|dd|d d |d | ƒ|_|jjtƒdS( Ntwidththeightt edgecolort facecolortrighttxityittexttfontproperties(Rt__init__t set_clip_ontFalsetNonet_locRt_text( tselftxyR R RRtfillRtlocR((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR*s       cC stj||ƒdS(N(Rt set_transform(Rttrans((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR@scC s$tj||ƒ|jj|ƒdS(N(Rt set_figureR(Rtfig((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR!DscC s|jS(sReturn the cell Text intance(R(R((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pytget_textHscC s|jj|ƒdS(N(Rt set_fontsize(Rtsize((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR$LscC s |jjƒS(sReturn the cell fontsize(Rt get_fontsize(R((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR&OscC sj|jƒ}|j|ƒ}xH|dkre||jƒkre|d8}|j|ƒ|j|ƒ}qW|S(s# Shrink font size until text fits. i(R&tget_required_widtht get_widthR$(Rtrenderertfontsizetrequired((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pytauto_set_font_sizeSs !  cC sA|jƒsdStj||ƒ|j|ƒ|jj|ƒdS(N(t get_visibleRtdrawt_set_text_positionR(RR)((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR.^s   c C sä|j|ƒ}|j\}}}}|jjdƒ||d}|jdkrr|jjdƒ||d}nX|jdkr¥|jjdƒ|||j}n%|jjdƒ||d|j}|jj||fƒdS(sm Set text up so it draws in the right place. Currently support 'left', 'center' and 'right' tcenterg@tleftRgð?N(tget_window_extenttboundsRtset_verticalalignmentRtset_horizontalalignmenttPADt set_position( RR)tbboxtltbR thRR((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR/hscC s.|jj|ƒ}|j|jƒƒ}|jS(s' Get text bounds in axes co-ordinates. (RR2tinverse_transformedtget_data_transformR3(RR)R8tbboxa((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pytget_text_boundsscC s.|j|ƒ\}}}}|dd|jS(s# Get width required for this cell. gð?g@(R?R6(RR)R9R:R R;((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR'‡scK s|jj|ƒdS(s&update the text properties with kwargsN(Rtupdate(Rtkwargs((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pytset_text_propssN(t__name__t __module__t__doc__R6tTrueRRRR!R#R$R&R,RR.R/R?R'RB(((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR#s$          tTablecB sUeZdZidd6dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6ZdZd%Zd8d8d&„Zd'„Zd(„Z e d)„ƒZ d*„Z d+„Z d,„ZeZd-„Zd.„Zd/„Zd0„Zed1„Zd2„Zd3„Zd4„Zd5„Zd6„Zd7„ZRS(9s7 Create a table of cells. Table can have (optional) row and column headers. Each entry in the table can be either text or patches. Column widths and row heights for the table can be specifified. Return value is a sequence of text, line and patch instances that make up the table itbestis upper rightis upper leftis lower leftis lower rightis center leftis center rightis lower centeris upper centeri R0i s top righti stop lefti s bottom lefti s bottom rightiRiR1ittopitbottomg{®Gáz”?cC sótj|ƒt|ƒrZ||jkrZtjd|dj|jjƒƒfƒd}nt|ƒr~|jj|dƒ}n|j |j ƒ||_ ||_ ||_ |j|jƒg|_i|_g|_g|_t|_d|_dS(NsIUnrecognized location %s. Falling back on bottom; valid locations are %s s RJi(RRRtcodestwarningstwarntjointkeystgetR!tfiguret_axesRt_bboxRt transAxest_textst_cellst _autoRowst _autoColumnsRFt _autoFontsizeRt_cachedRenderer(RtaxRR8((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR¶s" )          cO s_d}t|||Ž}|j|jƒ|j|jƒƒ|jtƒ||j||f|ddkr>|j|j|jƒ^q>}t|ƒ}|j|j |j ƒifSt ifSdS(sUTest whether the mouse event occurred in the table. Returns T/F, {} iiN( tcallablet _containsRZRRVROR2tbbox_alltcontainsRRR(Rt mouseeventRmRnR8((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyRsüs? cC s |jjƒS(s)Return the Artists contained by the table(RVtvalues(R((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyt get_childrenscC s/g|jD]}|j|ƒ^q }t|ƒS(s5Return the bounding box of the table in window coords(RVR2Rr(RR)tcRn((sC/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/table.pyR2s%cC sti}i}xy|jjƒD]h\\}}}|j|dƒ}t||jƒƒ||<|j|dƒ}t||jƒƒ||s$  nÿ*  a