chaco.plot_containers module

Defines various plot container classes, including stacked, grid, and overlay.

class chaco.plot_containers.GridPlotContainer(*components, **traits)

Bases: chaco.base_plot_container.BasePlotContainer

A GridPlotContainer consists of rows and columns in a tabular format.

Each cell’s width is the same as all other cells in its column, and each cell’s height is the same as all other cells in its row.

Although grid layout requires more layout information than a simple ordered list, this class keeps components as a simple list and exposes a shape trait.

class SizePrefs(length, direction)

Bases: object

Object to hold size preferences across spans in a particular dimension. For instance, if SizePrefs is being used for the row axis, then each element in the arrays below express sizing information about the corresponding column.

compute_size_array(size)

Given a length along the axis corresponding to this SizePref, returns an array of lengths to assign each cell, taking into account resizability and preferred sizes.

direction = <traits.trait_types.Enum object>
fixed_lengths

alias of traits.trait_numeric.Array

get_preferred_size()
index = <traits.trait_types.Int object>
resizable_lengths

alias of traits.trait_numeric.Array

update_from_component(component, index)

Given a component at a particular index along this SizePref’s axis, integrates the component’s resizability and sizing information into self.fixed_lengths and self.resizable_lengths.

update_from_pref_size(pref_length, index, resizable)
component_grid = Property

This property exposes the underlying grid structure of the container, and is the preferred way of setting and reading its contents. When read, this property returns a Numpy array with dtype=object; values for setting it can be nested tuples, lists, or 2-D arrays. The array is in row-major order, so that component_grid[0] is the first row, and component_grid[:,0] is the first column. The rows are ordered from top to bottom.

get_preferred_size(components=None)

Returns the size (width,height) that is preferred for this component.

Overrides PlotComponent.

halign = Enum("left", "right", "center")

The horizontal alignment of objects that don’t span the full width.

shape = Union(Tuple((0, 0)), List, Array)

The shape of this container, i.e, (rows, columns). The items in components are shuffled appropriately to match this specification. If there are fewer components than cells, the remaining cells are filled in with spaces. If there are more components than cells, the remainder wrap onto new rows as appropriate.

spacing = Union(None, Tuple, List, Array)

The amount of space to put on either side of each component, expressed as a tuple (h_spacing, v_spacing).

valign = Enum("bottom", "top", "center")

The vertical alignment of objects that don’t span the full height.

class chaco.plot_containers.HPlotContainer(*components, **traits)

Bases: enable.stacked_container.HStackedContainer

A plot container that stacks all of its components horizontally. Resizable components share the free space evenly. All components are stacked from according to stack_order* in the same order that they appear in the **components list.

container_under_layers = Tuple("background", "image", "underlay", "plot")

Redefine the container layers to name the main layer as “plot” instead of the Enable default of “mainlayer”

class chaco.plot_containers.OverlayPlotContainer(*components, **traits)

Bases: enable.overlay_container.OverlayContainer

A plot container that stretches all its components to fit within its space. All of its components must therefore be resizable.

container_under_layers = Tuple("background", "image", "underlay", "plot")

Redefine the container layers to name the main layer as “plot” instead of the Enable default of “mainlayer”

use_backbuffer = False

Do not use an off-screen backbuffer.

class chaco.plot_containers.VPlotContainer(*components, **traits)

Bases: enable.stacked_container.VStackedContainer

A plot container that stacks plot components vertically.

container_under_layers = Tuple("background", "image", "underlay", "plot")

Redefine the container layers to name the main layer as “plot” instead of the Enable default of “mainlayer”