Plums-Microlib Orchestrator

The role of the Orchestrator is, from a given list of DataPoint-like, to draw a composite figure, representing the different tiles with their respective annotations, with colors and a legend.

The Orchestrator is highly customizable, and different layouts of the mosaic can be built, depending on the use cases:

  • simple layout: the tiles will be placed following each others, mapping a rectangular grid. The number of columns of the final mosaic can be fixed.

  • adaptive layout: very similar with the simple layout, except that the last row of the mosaic is centered.

  • 2D layout: in the case where a 2D array-like of DataPoint is given to the Orchestrator, each line of the mosaic will correspond to a row of that array (the row being generally of different lengths).

class plums.plot.engine.orchestrator.OrchestratorBase[source]

Bases: plums.commons.data.mixin.PropertyContainer

Medium-level orchestrator which configure a Compositor and a ColorEngine from Descriptor and a layout.

It serves as an intermediary between high-level porcelain classes and low-level plumbing classes:

  • Its constructor gives access to all plumbing classes parameters to allow extensive configuration of the internal potting machinery (Moreover, every plumbing classes used parameters are accessible and parameterizable as attributes of the orchestrator instance.)

  • Its draw(layout) method takes a generic layout iterable as input with no assumption on the semantic role of a particular figure cell.

However, the plumbing call sequence does assume a standard workflow which reflect the porcelain classes API.

Parameters
  • main_descriptor (Descriptor) – A Descriptor to be used as primary descriptor in the ColorEngine.

  • secondary_descriptor (Descriptor) – Optional. Default to None. A Descriptor to be used as secondary descriptor in the ColorEngine.

  • zoom (float) – Optional. Default to 1. The zooming factor for each Tile in the layout.

  • title (str) – Optional. Default to None. The composite figure global title, if provided.

  • plot_centers (bool) – Optional. Default to False. If True, only a dot at the center of each Record is painted instead of the polygon geometry.

  • plot_tag (Descriptor) – Optional. Defaults to None. Besides the geometry, display a Record description in a tag attached to the Record.

  • fill (bool) – Optional. Default to False. A flag which represents whether to draw filled polygons.

  • **kwargs (Any) – Additional parameters to set.

main_descriptor

ColorEngine parameter: A Descriptor to be used as primary descriptor.

Type

Descriptor

secondary_descriptor

ColorEngine parameter: A Descriptor to be used as secondary descriptor.

Type

Descriptor

n_cols

Compositor parameter: Number of data points per line to not exceed (if 1D array-like of DataPoint).

Type

int

margins

Compositor parameter: Margin to use between each image of the mosaic.

Type

tuple

title

Compositor parameter: The composite figure global title, if provided.

Type

str

title_size

Compositor parameter: Font size of the title (in pixels).

Type

int

center

Compositor parameter: Center the last line of data points (if 1D array-like of DataPoint).

Type

bool

background_color

(Compositor, LegendPainter) Background color to use for the mosaic and the legend.

Type

tuple

scale

LegendPainter parameter: Scale to use, regarding the default dimensions used.

Type

float

axis

LegendPainter parameter: Main direction of the legend (0 = vertically, 1 = horizontally)

Type

int

item_margins

LegendPainter parameter: Margins around the item (left/right and top/bottom).

Type

tuple

main_axis_align

LegendPainter parameter: Alignment of the item in its cell along the main axis.

Type

str

minor_axis_align

LegendPainter parameter: Alignment of the item in its cell along the minor axis.

Type

str

zoom

Painter parameter: The zooming factor for each Tile in the layout.

Type

float

plot_centers

Painter parameter: If True, only a dot at the center of each Record is painted instead of the polygon geometry.

Type

bool

plot_confidences

Painter parameter: If True, a label with the confidence is painted next to each Record.

Type

bool

fill

Painter parameter: A flag which represents whether to draw filled polygons.

Type

bool

alpha

Painter parameter: A positive integer (between 0 and 255) that represents the fill transparency.

Type

int

class plums.plot.engine.orchestrator.Orchestrator(main_descriptor, secondary_descriptor=None, zoom=1, title=None, plot_centers=False, plot_tag=None, fill=False, **kwargs)[source]

Bases: plums.plot.engine.orchestrator.OrchestratorBase

Medium-level orchestrator which configure a Compositor and a ColorEngine from Descriptor and a layout.

It serves as an intermediary between high-level porcelain classes and low-level plumbing classes:

  • Its constructor gives access to all plumbing classes parameters to allow extensive configuration of the internal potting machinery (Moreover, every plumbing classes used parameters are accessible and parameterizable as attributes of the orchestrator instance.)

  • Its draw(layout) method takes a generic layout iterable as input with no assumption on the semantic role of a particular figure cell.

However, the plumbing call sequence does assume a standard workflow which reflect the porcelain classes API.

Parameters
  • main_descriptor (Descriptor) – A Descriptor to be used as primary descriptor in the ColorEngine.

  • secondary_descriptor (Descriptor) – Optional. Default to None. A Descriptor to be used as secondary descriptor in the ColorEngine.

  • zoom (float) – Optional. Default to 1. The zooming factor for each Tile in the layout.

  • title (str) – Optional. Default to None. The composite figure global title, if provided.

  • plot_centers (bool) – Optional. Default to False. If True, only a dot at the center of each Record is painted instead of the polygon geometry.

  • plot_confidences (bool) – Optional. Deprecated (Superseded by plot_tag). Defaults to False. If True, a label with the confidence is painted next to each Record.

  • plot_tag (Descriptor) – Optional. Defaults to None. Besides the geometry, display a Record description in a tag attached to the Record. Note that while plot_confidences is being deprecated, specifying it will override plot_tag.

  • fill (bool) – Optional. Default to False. A flag which represents whether to draw filled polygons.

  • **kwargs (Any) – Additional parameters to set.

main_descriptor

ColorEngine parameter: A Descriptor to be used as primary descriptor.

Type

Descriptor

secondary_descriptor

ColorEngine parameter: A Descriptor to be used as secondary descriptor.

Type

Descriptor

n_cols

Compositor parameter: Number of data points per line to not exceed (if 1D array-like of DataPoint).

Type

int

margins

Compositor parameter: Margin to use between each image of the mosaic.

Type

tuple

title

Compositor parameter: The composite figure global title, if provided.

Type

str

title_size

Compositor parameter: Font size of the title (in pixels).

Type

int

center

Compositor parameter: Center the last line of data points (if 1D array-like of DataPoint).

Type

bool

background_color

(Compositor, LegendPainter) Background color to use for the mosaic and the legend.

Type

tuple

scale

LegendPainter parameter: Scale to use, regarding the default dimensions used.

Type

float

axis

LegendPainter parameter: Main direction of the legend (0 = vertically, 1 = horizontally)

Type

int

item_margins

LegendPainter parameter: Margins around the item (left/right and top/bottom).

Type

tuple

main_axis_align

LegendPainter parameter: Alignment of the item in its cell along the main axis.

Type

str

minor_axis_align

LegendPainter parameter: Alignment of the item in its cell along the minor axis.

Type

str

zoom

Painter parameter: The zooming factor for each Tile in the layout.

Type

float

plot_centers

Painter parameter: If True, only a dot at the center of each Record is painted instead of the polygon geometry.

Type

bool

plot_tag

Painter parameter: Besides the geometry, display a Record description in a tag attached to the Record. Note that while plot_confidences is being deprecated, specifying it will override plot_tag.

Type

Descriptor

fill

Painter parameter: A flag which represents whether to draw filled polygons.

Type

bool

alpha

Painter parameter: A positive integer (between 0 and 255) that represents the fill transparency.

Type

int

draw(layout)[source]

Draw a composite figure according to the stored plumbing class parameters and a layout array.

Parameters

layout (array-like) – Two formats are allowed: a 2D array-like of DataPoint-like collection of Tile and RecordCollection to be drawn. Each line of the 2D array-like is expected to correspond to a line layout in the final mosaic cell. Or a 1D array-like of DataPoint. In that case, the data points will be placed side by side, forming a mosaic of tiles, with rows of same length.

Returns

A composite figure.

Return type

Image