You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
213 lines
6.1 KiB
213 lines
6.1 KiB
"""
|
|
This type stub file was generated by pyright.
|
|
"""
|
|
|
|
"""
|
|
A layoutgrid is a nrows by ncols set of boxes, meant to be used by
|
|
`._constrained_layout`, each box is analogous to a subplotspec element of
|
|
a gridspec.
|
|
|
|
Each box is defined by left[ncols], right[ncols], bottom[nrows] and top[nrows],
|
|
and by two editable margins for each side. The main margin gets its value
|
|
set by the size of ticklabels, titles, etc on each axes that is in the figure.
|
|
The outer margin is the padding around the axes, and space for any
|
|
colorbars.
|
|
|
|
The "inner" widths and heights of these boxes are then constrained to be the
|
|
same (relative the values of `width_ratios[ncols]` and `height_ratios[nrows]`).
|
|
|
|
The layoutgrid is then constrained to be contained within a parent layoutgrid,
|
|
its column(s) and row(s) specified when it is created.
|
|
"""
|
|
_log = ...
|
|
class LayoutGrid:
|
|
"""
|
|
Analogous to a gridspec, and contained in another LayoutGrid.
|
|
"""
|
|
def __init__(self, parent=..., parent_pos=..., parent_inner=..., name=..., ncols=..., nrows=..., h_pad=..., w_pad=..., width_ratios=..., height_ratios=...) -> None:
|
|
...
|
|
|
|
def __repr__(self): # -> str:
|
|
...
|
|
|
|
def reset_margins(self): # -> None:
|
|
"""
|
|
Reset all the margins to zero. Must do this after changing
|
|
figure size, for instance, because the relative size of the
|
|
axes labels etc changes.
|
|
"""
|
|
...
|
|
|
|
def add_constraints(self, parent): # -> None:
|
|
...
|
|
|
|
def hard_constraints(self): # -> None:
|
|
"""
|
|
These are the redundant constraints, plus ones that make the
|
|
rest of the code easier.
|
|
"""
|
|
...
|
|
|
|
def add_child(self, child, i=..., j=...): # -> None:
|
|
...
|
|
|
|
def parent_constraints(self, parent): # -> None:
|
|
...
|
|
|
|
def grid_constraints(self): # -> None:
|
|
...
|
|
|
|
def edit_margin(self, todo, size, cell): # -> None:
|
|
"""
|
|
Change the size of the margin for one cell.
|
|
|
|
Parameters
|
|
----------
|
|
todo : string (one of 'left', 'right', 'bottom', 'top')
|
|
margin to alter.
|
|
|
|
size : float
|
|
Size of the margin. If it is larger than the existing minimum it
|
|
updates the margin size. Fraction of figure size.
|
|
|
|
cell : int
|
|
Cell column or row to edit.
|
|
"""
|
|
...
|
|
|
|
def edit_margin_min(self, todo, size, cell=...): # -> None:
|
|
"""
|
|
Change the minimum size of the margin for one cell.
|
|
|
|
Parameters
|
|
----------
|
|
todo : string (one of 'left', 'right', 'bottom', 'top')
|
|
margin to alter.
|
|
|
|
size : float
|
|
Minimum size of the margin . If it is larger than the
|
|
existing minimum it updates the margin size. Fraction of
|
|
figure size.
|
|
|
|
cell : int
|
|
Cell column or row to edit.
|
|
"""
|
|
...
|
|
|
|
def edit_margins(self, todo, size): # -> None:
|
|
"""
|
|
Change the size of all the margin of all the cells in the layout grid.
|
|
|
|
Parameters
|
|
----------
|
|
todo : string (one of 'left', 'right', 'bottom', 'top')
|
|
margin to alter.
|
|
|
|
size : float
|
|
Size to set the margins. Fraction of figure size.
|
|
"""
|
|
...
|
|
|
|
def edit_all_margins_min(self, todo, size): # -> None:
|
|
"""
|
|
Change the minimum size of all the margin of all
|
|
the cells in the layout grid.
|
|
|
|
Parameters
|
|
----------
|
|
todo : {'left', 'right', 'bottom', 'top'}
|
|
The margin to alter.
|
|
|
|
size : float
|
|
Minimum size of the margin. If it is larger than the
|
|
existing minimum it updates the margin size. Fraction of
|
|
figure size.
|
|
"""
|
|
...
|
|
|
|
def edit_outer_margin_mins(self, margin, ss): # -> None:
|
|
"""
|
|
Edit all four margin minimums in one statement.
|
|
|
|
Parameters
|
|
----------
|
|
margin : dict
|
|
size of margins in a dict with keys 'left', 'right', 'bottom',
|
|
'top'
|
|
|
|
ss : SubplotSpec
|
|
defines the subplotspec these margins should be applied to
|
|
"""
|
|
...
|
|
|
|
def get_margins(self, todo, col):
|
|
"""Return the margin at this position"""
|
|
...
|
|
|
|
def get_outer_bbox(self, rows=..., cols=...): # -> Bbox:
|
|
"""
|
|
Return the outer bounding box of the subplot specs
|
|
given by rows and cols. rows and cols can be spans.
|
|
"""
|
|
...
|
|
|
|
def get_inner_bbox(self, rows=..., cols=...): # -> Bbox:
|
|
"""
|
|
Return the inner bounding box of the subplot specs
|
|
given by rows and cols. rows and cols can be spans.
|
|
"""
|
|
...
|
|
|
|
def get_bbox_for_cb(self, rows=..., cols=...): # -> Bbox:
|
|
"""
|
|
Return the bounding box that includes the
|
|
decorations but, *not* the colorbar...
|
|
"""
|
|
...
|
|
|
|
def get_left_margin_bbox(self, rows=..., cols=...): # -> Bbox:
|
|
"""
|
|
Return the left margin bounding box of the subplot specs
|
|
given by rows and cols. rows and cols can be spans.
|
|
"""
|
|
...
|
|
|
|
def get_bottom_margin_bbox(self, rows=..., cols=...): # -> Bbox:
|
|
"""
|
|
Return the left margin bounding box of the subplot specs
|
|
given by rows and cols. rows and cols can be spans.
|
|
"""
|
|
...
|
|
|
|
def get_right_margin_bbox(self, rows=..., cols=...): # -> Bbox:
|
|
"""
|
|
Return the left margin bounding box of the subplot specs
|
|
given by rows and cols. rows and cols can be spans.
|
|
"""
|
|
...
|
|
|
|
def get_top_margin_bbox(self, rows=..., cols=...): # -> Bbox:
|
|
"""
|
|
Return the left margin bounding box of the subplot specs
|
|
given by rows and cols. rows and cols can be spans.
|
|
"""
|
|
...
|
|
|
|
def update_variables(self): # -> None:
|
|
"""
|
|
Update the variables for the solver attached to this layoutgrid.
|
|
"""
|
|
...
|
|
|
|
|
|
|
|
_layoutboxobjnum = ...
|
|
def seq_id(): # -> str:
|
|
"""Generate a short sequential id for layoutbox objects."""
|
|
...
|
|
|
|
def plot_children(fig, lg=..., level=...): # -> None:
|
|
"""Simple plotting to show where boxes are."""
|
|
...
|
|
|