File: //opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyo
�
�)�Uc @ s� d Z d d l m Z d d l Z e j Z d d l j Z d d l Z d e
f d � � YZ d e f d � � YZ d e f d � � YZ
d
e
f d � � YZ d S( s�
:mod:`~matplotlib.gridspec` is a module which specifies the location
of the subplot in the figure.
``GridSpec``
specifies the geometry of the grid that a subplot will be
placed. The number of rows and number of columns of the grid
need to be set. Optionally, the subplot layout parameters
(e.g., left, right, etc.) can be tuned.
``SubplotSpec``
specifies the location of the subplot in the given *GridSpec*.
i����( t divisionNt GridSpecBasec B sw e Z d Z d d d � Z d � Z d d � Z d d d � Z d � Z d � Z d � Z
d � Z d
� Z d � Z
RS(
sm
A base class of GridSpec that specifies the geometry of the grid
that a subplot will be placed.
c C s1 | | | _ | _ | j | � | j | � d S( s�
The number of rows and number of columns of the grid need to
be set. Optionally, the ratio of heights and widths of ros and
columns can be specified.
N( t _nrowst _ncolst set_height_ratiost set_width_ratios( t selft nrowst ncolst
height_ratiost width_ratios( ( sF /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyt __init__ s
c C s | j | j f S( s$ get the geometry of the grid, eg 2,3( R R ( R ( ( sF /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyt get_geometry- s c C s d S( N( ( R t fig( ( sF /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyt get_subplot_params1 s i c C s4 | \ } } | | | | � | | | � f } | S( s:
create and return a SuplotSpec instance.
( ( R t loct rowspant colspant loc1t loc2t subplotspec( ( sF /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyt new_subplotspec4 s $c C s
| | _ d S( N( t _col_width_ratios( R R
( ( sF /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyR = s c C s | j S( N( R ( R ( ( sF /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyt get_width_ratios@ s c C s
| | _ d S( N( t _row_height_ratios( R R ( ( sF /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyR C s c C s | j S( N( R ( R ( ( sF /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyt get_height_ratiosF s c ! C s� | j � \ } } | j | � } | j } | j } | j } | j } | j } | j }
| | } | | } | | |
| d }
|
|
} | j d k r� |
| } t
t | j � � } g | j D] } | | | ^ q� } n
|
g | } d g | g | d } t j
j t j t | | � � � } | | | | d } | | } | j d k r�| | } t
t | j � � } g | j D] } | | | ^ q�} n
| g | } d g | g | d } t j
j t j t | | � � � } g t | � D] } | | d | ^ q�} g t | � D] } | | d | d ^ q} g t | � D] } | | d | ^ qN} g t | � D] } | | d | d ^ qy} | | | | f S( so
return lists of bottom and top position of rows, left and
right positions of columns.
i i i N( R R t leftt rightt bottomt topt wspacet hspaceR t Nonet floatt sumt npt addt
accumulatet ravelt zipR t range(! R R
R R t subplot_paramsR R R R R R t totWidtht totHeightt cellHt sepHt netHeightt trt rt cellHeightst
sepHeightst cellHst cellWt sepWt netWidtht
cellWidthst sepWidthst cellWst rowNumt figTopst
figBottomst colNumt figLeftst figRights( ( sF /opt/alt/python27/lib64/python2.7/site-packages/matplotlib/gridspec.pyt get_grid_positionsJ sB
'
$
'
$+/+/c C s� | j � \ } } | | } t | t � r*y | \ } } Wn t k
rZ t d � � n Xt | t � r� | j | � \ } } } n* | d k r� | | 7} n | | d } } t | t � r� | j | � \ }
} } n* | d k r� | | 7} n | | d }
} | | |
} | d | | d }
nZ t | t � r^| j | � \ } }
} |
d 8}
n&