Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/matplotlib/__pycache__/table.cpython-37.pyc

365 lines
22 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
U<>]wh<00>@s<>dZddlmZmZmZddlmZmZddlmZddl m
Z
ddl m Z ddl mZGdd <09>d e<08>ZGd
d <0B>d e<0F>ZGd d <0A>d e<05>Zejje<02>e<11>d<0E>ejddd<16><01>ZdS)a<>
This module provides functionality to add a table to a plot.
Use the factory function `~matplotlib.table.table` to create a ready-made
table from texts. If you need more control, use the `.Table` class and its
methods.
The table consists of a grid of cells, which are indexed by (row, column).
The cell (0, 0) is positioned at the top left.
Thanks to John Gill for providing the class and table.
<EFBFBD>)<03>artist<73>cbook<6F> docstring)<02>Artist<73>allow_rasterization)<01> Rectangle)<01>Text)<01>Bbox)<01>Pathc@s<>eZdZdZdZd dd <09>Zd
d <0B>Zd d <0A>Zdd<0F>Zdd<11>Z dd<13>Z
dd<15>Z e dd<17><00>Z dd<19>Zdd<1B>Zdd<1D>Zejdd<1F><00>ZdS)!<21>Cella<6C>
A cell is a `.Rectangle` with some associated `.Text`.
.. note:
As a user, you'll most likely not creates cells yourself. Instead, you
should use either the `~matplotlib.table.table` factory function or
`.Table.add_cell`.
Parameters
----------
xy : 2-tuple
The position of the bottom left corner of the cell.
width : float
The cell width.
height : float
The cell height.
edgecolor : color spec
The color of the cell border.
facecolor : color spec
The cell facecolor.
fill : bool
Whether the cell background is filled.
text : str
The cell text.
loc : {'left', 'center', 'right'}, default: 'right'
The alignment of the text within the cell.
fontproperties : dict
A dict defining the font properties of the text. Supported keys and
values are the keyword arguments accepted by `.FontProperties`.
g<><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?<3F>k<>wT<77>Nc
Cs^tj|||||||d<01>|<00>d<02>|dkr.d}||_t|d|d|| d<06>|_|j<05>d<02>dS)N)<05>width<74>height<68>fill<6C> edgecolor<6F> facecolorF<72>right<68>r)<04>x<>y<>text<78>fontproperties)r<00>__init__<5F> set_clip_on<6F>_locr<00>_text)
<EFBFBD>self<6C>xyrrrrrr<00>locr<00>r!<00>8/tmp/pip-install-i8dhxrtk/matplotlib/matplotlib/table.pyrAs 


z Cell.__init__cCst<00>||<01>d|_dS)NT)r<00> set_transform<72>stale)rZtransr!r!r"r#Vs zCell.set_transformcCst<00>||<01>|j<02>|<01>dS)N)r<00>
set_figurer)rZfigr!r!r"r%[s zCell.set_figurecCs|jS)z!Return the cell `.Text` instance.)r)rr!r!r"<00>get_text_sz Cell.get_textcCs|j<00>|<01>d|_dS)zSet the text fontsize.TN)r<00> set_fontsizer$)r<00>sizer!r!r"r'cs zCell.set_fontsizecCs
|j<00><01>S)zReturn the cell fontsize.)r<00> get_fontsize)rr!r!r"r)hszCell.get_fontsizecCsL|<00><00>}|<00>|<01>}x4|dkrF||<00><02>krF|d8}|<00>|<02>|<00>|<01>}qW|S)z9Shrink font size until the text fits into the cell width.r)r)<00>get_required_width<74> get_widthr')r<00>renderer<65>fontsize<7A>requiredr!r!r"<00>auto_set_font_sizels

zCell.auto_set_font_sizecCs8|<00><00>s dSt<01>||<01>|<00>|<01>|j<04>|<01>d|_dS)NF)<06> get_visibler<00>draw<61>_set_text_positionrr$)rr,r!r!r"r1ws  
 z Cell.drawc Cs<>|<00>|<01>}|j\}}}}|j<02>d<01>||d}|jdkrT|j<02>d<01>||d}nD|jdkrz|j<02>d<03>|||j}n|j<02>d<04>||d|j}|j<02>||f<02>dS)zlSet text up so it draws in the right place.
Currently support 'left', 'center' and 'right'
<20>centerg@<40>leftrg<00>?N)<08>get_window_extent<6E>boundsrZset_verticalalignmentrZset_horizontalalignment<6E>PADZ set_position) rr,<00>bbox<6F>l<>br <00>hrrr!r!r"r2<00>s
  
 
  zCell._set_text_positioncCs |j<00>|<01>}|<02>|<00><03><00>}|jS)zY
Return the text bounds as *(x, y, width, height)* in table coordinates.
)rr5<00>inverse_transformedZget_data_transformr6)rr,r8Zbboxar!r!r"<00>get_text_bounds<64>s zCell.get_text_boundscCs$|<00>|<01>\}}}}|dd|jS)z/Return the minimal required width for the cell.g<00>?g@)r=r7)rr,r9r:r r;r!r!r"r*<00>szCell.get_required_widthcKs|j<00>|<01>d|_dS)zX
Update the text properties.
Valid kwargs are
%(Text)s
TN)r<00>updater$)r<00>kwargsr!r!r"<00>set_text_props<70>s zCell.set_text_props)r r TrNN)<14>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__r7rr#r%r&r'r)r/rr1r2r=r*r<00>dedent_interpdr@r!r!r!r"r s$
 r csTeZdZdZdZdeddd<06>Z<05>fdd<08>Zed d
<EFBFBD><00>Zej d d
<EFBFBD><00>Zd d <0A>Z
<EFBFBD>Z S)<0E>
CustomCellz?
A `.Cell` subclass with configurable edge visibility.
ZBRTLrZBTZRL)<04>open<65>closedZ
horizontalZverticalcst<00>j||<03>||_dS)N)<03>superr<00> visible_edges)rrJ<00>argsr?)<01> __class__r!r"r<00>szCustomCell.__init__cCs|jS)a"
The cell edges to be drawn with a line.
Reading this property returns a substring of 'BRTL' (bottom, right,
top, left').
When setting this property, you can use a substring of 'BRTL' or one
of {'open', 'closed', 'horizontal', 'vertical'}.
)<01>_visible_edges)rr!r!r"rJ<00>s zCustomCell.visible_edgescsr|dkr<12>j<00>_nV|<01>jkr*<2A>j|<00>_n>t<03>fdd<02>|D<00><01>rbtd<03>|d<04><06>j<02>d<04><06>j<00><01><03><01>|<01>_d<05>_dS)Nc3s|]}|<01>jkVqdS)N)<01>_edges)<02>.0<EFBFBD>edge)rr!r"<00> <genexpr><3E>sz+CustomCell.visible_edges.<locals>.<genexpr>z=Invalid edge param {}, must only be one of {} or string of {}z, T)rNrM<00> _edge_aliases<65>any<6E>
ValueError<EFBFBD>format<61>joinr$)r<00>valuer!)rr"rJ<00>s


cCs<>tjg}x2|jD](}||jkr,|<01>tj<05>q|<01>tj<01>qWtj|dd<02>krXtj|d<tddgddgddgddgddgg|dd<07>S)z*Return a `.Path` for the `.visible_edges`.rN<><4E><EFBFBD><EFBFBD><EFBFBD>gg<00>?T)<01>readonly)r
ZMOVETOrNrM<00>appendZLINETOZ CLOSEPOLY)r<00>codesrPr!r!r"<00>get_path<74>s 

 zCustomCell.get_path) rArBrCrDrNrRr<00>propertyrJ<00>setterr\<00> __classcell__r!r!)rLr"rF<00>s  rFc@seZdZdZdddddddd d
d d d ddddddd<14>Zd ZdZdDdd<18>Zdd<1A>Zdd<1C>Z dd<1E>Z
e dd <20><00>Z e j d!d <20><00>Z d"d#<23>Zed$d%<25><00>Zd&d'<27>Zd(d)<29>Zd*d+<2B>Ze<14>d,<2C>e<13>Zd-d.<2E>Zd/d0<64>Zd1d2<64>Zd3d4<64>ZdEd6d7<64>Zd8d9<64>Zd:d;<3B>Zd<d=<3D>Zd>d?<3F>Zd@dA<64>Z dBdC<64>Z!dS)F<>TableaD
A table of cells.
The table consists of a grid of cells, which are indexed by (row, column).
For a simple table, you'll have a full grid of cells with indices from
(0, 0) to (num_rows-1, num_cols-1), in which the cell (0, 0) is positioned
at the top left. However, you can also add cells with negative indices.
You don't have to add a cell to every grid position, so you can create
tables that have holes.
*Note*: You'll usually not create an empty table from scratch. Instead use
`~matplotlib.table.table` to create a table from data.
rr<00><00><00><00><00><00><00><00> <00>
<00> <00> <00> <00><00><00><00>)<12>bestz upper rightz
upper leftz
lower leftz lower rightz center leftz center rightz lower centerz upper centerr3z top rightztop leftz bottom leftz bottom rightrr4<00>top<6F>bottomg{<14>G<EFBFBD>z<EFBFBD>?NcKs<>t<00>|<00>t|t<03>rJ||jkr@tjdd<02>|d<03>|j<04><01>d<04>d}|j|}|<00> |j
<EFBFBD>||_ ||_ ||_ |<00>|j<0F>i|_d|_g|_d|_|<00>|<04>|<00>d<08>dS) a<>
Parameters
----------
ax : `matplotlib.axes.Axes`
The `~.axes.Axes` to plot the table into.
loc : str
The position of the cell with respect to *ax*. This must be one of
the `~.Table.codes`.
bbox : `.Bbox` or None
A bounding box to draw the table into. If this is not *None*, this
overrides *loc*.
Other Parameters
----------------
**kwargs
`.Artist` properties.
z3.1zwUnrecognized location {!r}. Falling back on 'bottom'; valid locations are
{}
This will raise an exception %(removal)s.z
)<01>messagersNTF)rr<00>
isinstance<EFBFBD>strr[rZwarn_deprecatedrUrVr%<00>figure<72>_axesr<00>_bboxr#Z transAxes<65>_cellsrN<00> _autoColumns<6E> _autoFontsizer>r)r<00>axr r8r?r!r!r"rs&



  
zTable.__init__cOs.d}t|f|<03>d|ji|<04><02>}||||f<|S)ac
Create a cell and add it to the table.
Parameters
----------
row : int
Row index.
col : int
Column index.
*args, **kwargs
All other parameters are passed on to `Cell`.
Returns
-------
cell : `.CustomCell`
The created cell.
)rrrJ)rF<00>edges)r<00>row<6F>colrKr?r<00>cellr!r!r"<00>add_cellMs zTable.add_cellcCs<>t|t<01>std<01><01>y|d|d}}Wntk
rDtd<04><01>YnX|<02>|j<06>|<02>|<00><08><00>|<02> d<05>||j
||f<d|_ dS)z8
Set a custom cell in a given position.
zTable only accepts CustomCellrrz0Only tuples length 2 are accepted as coordinatesFTN) rurF<00> TypeError<6F> Exception<6F>KeyErrorr%rwr#<00> get_transformrrzr$)r<00>positionr<6E>rr<>r!r!r"<00> __setitem__es
 
zTable.__setitem__cCs
|j|S)z-Retrieve a custom cell from a given position.)rz)rr<>r!r!r"<00> __getitem__uszTable.__getitem__cCs|jS)a<>
The default value of `~.CustomCell.visible_edges` for newly added
cells using `.add_cell`.
Notes
-----
This setting does currently only affect newly created cells using
`.add_cell`.
To change existing cells, you have to set their edges explicitly::
for c in tab.get_celld().values():
c.visible_edges = 'horizontal'
)rN)rr!r!r"r~ysz Table.edgescCs||_d|_dS)NT)rNr$)rrWr!r!r"r~<00>scCs |jd|jj|jjjdS)NgR@g333333<33>?)<06>FONTSIZErwZdpirxr8r)rr!r!r"<00>_approx_text_height<68>szTable._approx_text_heightcCsx|dkr|jj}|dkr td<01><01>|<00><03>s,dS|<01>d<02>|<00>|<01>x"t|j<07>D]}|j|<00>|<01>qLW|<01> d<02>d|_
dS)NzNo renderer defined<65>tableF) rw<00>_cachedRenderer<65> RuntimeErrorr0Z
open_group<EFBFBD>_update_positions<6E>sortedrzr1Z close_groupr$)rr,<00>keyr!r!r"r1<00>s


z
Table.drawcs0<00>fdd<02>|j<00><01>D<00>}t<02>|<02>}|<03>|<00><05><00>S)zrGet a bbox, in axes co-ordinates for the cells.
Only include those in the range (0,0) to (maxRow, maxCol)cs.g|]&\\}}}|dkr|dkr|<03><00><00><01>qS)r)r5)rOrr<>r<>)r,r!r"<00>
<listcomp><3E>s
z(Table._get_grid_bbox.<locals>.<listcomp>)rz<00>itemsr <00>unionr<r<>)rr,<00>boxesr8r!)r,r"<00>_get_grid_bbox<6F>s

zTable._get_grid_bboxcsh|jdk r|<00>||<01>S|jj<02><00>dk r\<5C>fdd<02>|j<03><04>D<00>}t<05>|<02>}|<03>|j|j <09>ifSdifSdS)Ncs.g|]&\\}}}|dkr|dkr|<03><00><00><01>qS)r)r5)rOrr<>r<>)r,r!r"r<><00>s
z"Table.contains.<locals>.<listcomp>F)
Z _containsrwr<>rzr<>r r<><00>containsrr)rZ
mouseeventr<EFBFBD>r8r!)r,r"r<><00>s
 

zTable.containscCst|j<01><02><00>S)z*Return the Artists contained by the table.)<03>listrz<00>values)rr!r!r"<00> get_children<65>szTable.get_childrenz3.0cs"<00>fdd<02>|j<00><01>D<00>}t<02>|<02>S)z6Return the bounding box of the table in window coords.csg|]}|<01><00><00><01>qSr!)r5)rOr<>)r,r!r"r<><00>sz+Table.get_window_extent.<locals>.<listcomp>)rzr<>r r<>)rr,r<>r!)r,r"r5<00>s
zTable.get_window_extentc Cs<>i}i}xV|j<00><01>D]H\\}}}|<02>|d<01>}t||<05><04><00>||<|<01>|d<01>}t||<05><05><00>||<qWd}i} x$t|<01>D]}|| |<|||7}qrWd}
i} x(t|dd<04>D]}|
| |<|
||7}
q<EFBFBD>Wx6|j<00><01>D](\\}}}|<05>| |<00>|<05>| |<00>q<>WdS)zV
Calculate row heights and column widths; position cells accordingly.
grT)<01>reverseN) rzr<><00>
setdefault<EFBFBD>max<61>
get_heightr+r<><00>set_x<5F>set_y) rZwidthsZheightsrr<>r<>rrZxposZleftsZyposZbottomsr!r!r"<00>_do_cell_alignment<6E>s(  zTable._do_cell_alignmentc CsVy t|<01>Wn$ttfk
r0|j<03>|<01>YnXx|D]}|j<03>|<02>q8Wd|_dS)z<>
Automatically set the widths of given columns to optimal sizes.
Parameters
----------
col : int or sequence of ints
The indices of the columns to auto-scale.
TN)<06>iterr<72><00>AttributeErrorr{rZr$)rr<>r<>r!r!r"<00>auto_set_column_width<74>s
 
zTable.auto_set_column_widthcsN<00>fdd<02>|j<00><01>D<00>}t<02>fdd<04>|D<00>dd<06>}x|D]}|<05>|<04>q8WdS)z#Automatically set width for column.cs g|]\}}|d<00>kr|<02>qS)rr!)rOr<>r<>)r<>r!r"r<>sz0Table._auto_set_column_width.<locals>.<listcomp>c3s|]}|<01><00><00>VqdS)N)r*)rOr<>)r,r!r"rQsz/Table._auto_set_column_width.<locals>.<genexpr>r)<01>defaultN)rzr<>r<><00> set_width)rr<>r,<00>cells<6C> max_widthr<68>r!)r<>r,r"<00>_auto_set_column_widths

zTable._auto_set_column_widthTcCs||_d|_dS)zAutomatically set font size.TN)r|r$)rrWr!r!r"r/ szTable.auto_set_font_sizecCs<>t|j<01>dkrdStt|j<01><04><00><01><01><05>}g}xD|j<01><06>D]6\}}|d|jkrPq8|<05>|<01>}t ||<06>}|<03>
|<05>q8Wx|j<01><04>D]}|<05> |<02>q~WdS)Nrr) <0C>lenrz<00>nextr<74>r<>r)r<>r{r/<00>minrZr')rr,r-r<>r<>r<>r(r!r!r"<00>_auto_set_font_sizes

zTable._auto_set_font_sizecCs<x6|j<00><01>D](}|<03>|<03><03>|<00>|<03>|<03><05>|<00>q WdS)z<Scale column widths by *xscale* and row heights by *yscale*.N)rzr<>r<>r+Z
set_heightr<EFBFBD>)rZxscaleZyscale<6C>cr!r!r"<00>scale#sz Table.scalecCs(x|j<00><01>D]}|<02>|<01>q Wd|_dS)a>
Set the font size, in points, of the cell text.
Parameters
----------
size : float
Notes
-----
As long as auto font size has not been disabled, the value will be
clipped such that the text fits horizontally into the cell.
You can disable this behavior using `.auto_set_font_size`.
>>> the_table.auto_set_font_size(False)
>>> the_table.set_fontsize(20)
However, there is no automatic scaling of the row height so that the
text may exceed the cell boundary.
TN)rzr<>r'r$)rr(r<>r!r!r"r')szTable.set_fontsizecCsFx@|j<00><01>D]2}|<03><02>|<03><03>}}|<03>||<00>|<03>||<00>q WdS)z-Move all the artists by ox, oy (axes coords).N)rzr<>Zget_xZget_yr<79>r<>)r<00>ox<6F>oyr<79>rrr!r!r"<00>_offsetBsz Table._offsetc Cs,x|jD]}|<00>||<01>qW|jr,|<00>|<01>|<00><04>|<00>|<01>}|j\}}}}|jdk r<>|j\}} }
} |<00>|
|| |<00>||} | |} |<00><04><00>n<>t t
|j <0B><01>\}}}}}}}}}}}}}}}}}}d|d|} d|d|} |j |||fk<06>r|j |} |j |||||fk<06>r*d|||j } |j ||||fk<06>rPd|||j } |j |||fk<06>rl|j |} |j |||fk<06>r<>d|d|} |j |||fk<06>r<>d|d|} |j |||fk<06>r<>|| } |j |||fk<06>r<>d|} |j |||fk<06>rd|} |j |||fk<06>r|| } |<00>| | <0A>dS)Ng<00>?rarg<00>?)r{r<>r|r<>r<>r<>r6ryr<><00>ranger<65>r[r<00>AXESPADr<44>) rr,r<>r8r9r:r r;Zrl<72>rb<72>rwZrhr<68>r<>ZBESTZURZULZLLZLRZCL<43>CRZLCZUC<55>CZTRZTLZBLZBR<42>R<>L<>T<>Br!r!r"r<>IsJ 


 2



zTable._update_positionscCs|jS)a
Return a dict of cells in the table mapping *(row, column)* to
`.Cell`\s.
Notes
-----
You can also directly index into the Table object to access individual
cells::
cell = table[row, col]
)rz)rr!r!r"<00> get_celld<6C>s zTable.get_celld)NN)T)"rArBrCrDr[r<>r<>rr<>r<>r<>r]r~r^r<>rr1r<>r<>r<>r<00>
deprecatedZget_child_artistsr5r<>r<>r<>r/r<>r<>r'r<>r<>r<>r!r!r!r"r`<00>sX
.  

7r`)r`Nrr4r3rsrHc Ks<>|dkr|dkrtd<02><01>|dkrDt|<02>}t|d<00>}dg|g|}t|<01>}t|d<00>}x&|D]}t|<11>|kr^td<05>|<10><01><01>q^W|dk r<>t|<02>|kr<>td<06>|<0F><01><01>x6|D]}t|<11>|kr<>td<07>|<10><01><01>q<>Wnd|g|}|dkr<>d |g|}d}|dk<08>r|dk <09>r.dg|}|d}n|dk<08>r.d|}|dk <09>rTt|<05>|k<03>rTtd
<EFBFBD>|<0F><01><01>d }|dk<08>r~| dk <09>rxdg|}nd}n| dk<08>r<>d|} |dk<08>r<>d|g|}t|| | f|<0E>}| |_|<14><05>}xVt|<0F>D]J}xBt|<10>D]6}|j|||||||||||||d <0C><00>q<>W<00>q<>W|dk <09>r`x6t|<10>D]*}|jd||||||| ||
d <0C><00>q2W|dk <09>r<>x<t|<0F>D]0}|j||d |<12>p<>d||||||d <0C><00>qtW|dk<02>r<>|<14>d <0A>|<00> |<14>|S)a<>
Add a table to an `~.axes.Axes`.
At least one of *cellText* or *cellColours* must be specified. These
parameters must be 2D lists, in which the outer lists define the rows and
the inner list define the column values per row. Each row must have the
same number of elements.
The table can optionally have row and column headers, which are configured
using *rowLabels*, *rowColours*, *rowLoc* and *colLabels*, *colColours*,
*colLoc* respectively.
For finer grained control over tables, use the `.Table` class and add it to
the axes with `.Axes.add_table`.
Parameters
----------
cellText : 2D list of str, optional
The texts to place into the table cells.
*Note*: Line breaks in the strings are currently not accounted for and
will result in the text exceeding the cell boundaries.
cellColours : 2D list of matplotlib color specs, optional
The background colors of the cells.
cellLoc : {'left', 'center', 'right'}, default: 'right'
The alignment of the text within the cells.
colWidths : list of float, optional
The column widths in units of the axes. If not given, all columns will
have a width of *1 / ncols*.
rowLabels : list of str, optional
The text of the row header cells.
rowColours : list of matplotlib color specs, optional
The colors of the row header cells.
rowLoc : {'left', 'center', 'right'}, optional, default: 'left'
The text alignment of the row header cells.
colLabels : list of str, optional
The text of the column header cells.
colColours : list of matplotlib color specs, optional
The colors of the column header cells.
rowLoc : {'left', 'center', 'right'}, optional, default: 'left'
The text alignment of the column header cells.
loc : str, optional
The position of the cell with respect to *ax*. This must be one of
the `~.Table.codes`.
bbox : `.Bbox`, optional
A bounding box to draw the table into. If this is not *None*, this
overrides *loc*.
edges : substring of 'BRTL' or {'open', 'closed', 'horizontal', 'vertical'}
The cell edges to be drawn with a line. See also
`~.CustomCell.visible_edges`.
Other Parameters
----------------
**kwargs
`.Table` properties.
%(Table)s
Returns
-------
table : `~matplotlib.table.Table`
The created table.
NzZAt least one argument from "cellColours" or "cellText" must be provided to create a table.rrz+Each row in 'cellText' must have {} columnsz'cellColours' must have {} rowsz.Each row in 'cellColours' must have {} columnsr g<00>?z!'rowLabels' must be of length {0}r)rrrrr rXgV瞯<03><)
rTr<>rUr`r~r<>r<>r<>r<>Z add_table)r}ZcellTextZ cellColoursZcellLocZ colWidthsZ rowLabelsZ
rowColoursZrowLocZ colLabelsZ
colColoursZcolLocr r8r~r?Zrows<77>colsrZ rowLabelWidth<74>offsetr<74>rr<>r!r!r"r<><00>s<>T  
   
 







 

 


 
 
 


r<>) NNrNNNr4NNr3rsNrH)rDrrrrrrZpatchesrrrZ
transformsr <00>pathr
r rFr`Zinterpdr>ZkwdocrEr<>r!r!r!r"<00><module>s(    A