marsilea.layout.CrossLayout#

class CrossLayout(name, width, height, init_main=True, projection=None, margin=0.2)#

Bases: _MarginMixin

The cross-layout engine

This class implements the cross-layout. The axes are added incrementally to the main axes.

  • The size is always in the unit of inches

Parameters:
namestr

The name of the main canvas

widthfloat

The width of the main canvas

heightfloat

The height of the main canvas

init_mainbool

Add the main canvas as axes

projectionstr

The projection of the main canvas

Attributes:
is_compositebool

Use to indicate the current position of CrossLayout. Whether it’s in a CompositeCrossLayout.

add_ax(side, name, size, pad=0.0, projection=None)#

Add an axes to the layout

Parameters:
side
name
size
pad
projection
Returns:
add_legend_ax(side, size, pad=0.0)#

Add a legend axes

Parameters:
side
size
pad
Returns:
add_pad(side, size)#

Add padding between axes

Parameters:
side
size
Returns:
append(side, other)#
freeze(figure=None, scale=1, _debug=False)#

Freeze the current layout and draw on figure

Freeze is safe to be called multiple times, it will update the layout if draw on the same figure

Parameters:
figurematplotlib.figure.Figure

A matplotlib figure instance

scalefloat

To scale the size of figure

_debugbool

Not a public parameter, for internal debug use, the information display on the canvas is not guarantee to be consistent.

Returns:
get_ax(name)#
get_bbox_height()#

Get the bbox height in inches

get_bbox_size()#

Get the bbox size in inches (width, height)

get_bbox_width()#

Get the bbox width in inches

get_figure_size()#

Get the figsize in inches (width, height)

get_legend_ax()#
get_main_anchor()#

Get the main anchor point

get_main_ax()#
get_main_height()#
get_main_width()#
get_side_size(side)#
hsplit(name, chunk_ratios, spacing=0.05, group_ratios=None)#
initiate_axes(figure, _debug=False)#
is_split(name)#

Query if a cell is split

plot(scale=1)#
remove_ax(name)#
remove_legend_ax()#
set_anchor(anchor)#
set_figsize(figsize)#
set_layout(main_anchor)#

Set the layout of all cell

Parameters:
main_anchorpoint

The anchor point of the main cell

set_legend_size(size)#
set_main_height(height)#
set_main_width(width)#
set_render_size(name, size)#
vsplit(name, chunk_ratios, spacing=0.05, group_ratios=None)#