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
DataPointis given to theOrchestrator, 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.PropertyContainerMedium-level orchestrator which configure a
Compositorand aColorEnginefromDescriptorand 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 genericlayoutiterable 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) – ADescriptorto be used as primary descriptor in theColorEngine.secondary_descriptor (
Descriptor) – Optional. Default toNone. ADescriptorto be used as secondary descriptor in theColorEngine.zoom (float) – Optional. Default to
1. The zooming factor for eachTilein thelayout.title (str) – Optional. Default to
None. The composite figure global title, if provided.plot_centers (bool) – Optional. Default to
False. IfTrue, only a dot at the center of eachRecordis painted instead of the polygon geometry.plot_tag (
Descriptor) – Optional. Defaults toNone. Besides the geometry, display aRecorddescription in a tag attached to theRecord.fill (bool) – Optional. Default to
False. A flag which represents whether to draw filled polygons.**kwargs (Any) – Additional parameters to set.
-
main_descriptor¶ ColorEngineparameter: ADescriptorto be used as primary descriptor.- Type
-
secondary_descriptor¶ ColorEngineparameter: ADescriptorto be used as secondary descriptor.- Type
-
n_cols¶ Compositorparameter: Number of data points per line to not exceed (if 1D array-like ofDataPoint).- Type
-
center¶ Compositorparameter: Center the last line of data points (if 1D array-like ofDataPoint).- Type
-
background_color¶ (
Compositor,LegendPainter) Background color to use for the mosaic and the legend.- Type
-
scale¶ LegendPainterparameter: Scale to use, regarding the default dimensions used.- Type
-
axis¶ LegendPainterparameter: Main direction of the legend (0 = vertically, 1 = horizontally)- Type
-
item_margins¶ LegendPainterparameter: Margins around the item (left/right and top/bottom).- Type
-
main_axis_align¶ LegendPainterparameter: Alignment of the item in its cell along the main axis.- Type
-
minor_axis_align¶ LegendPainterparameter: Alignment of the item in its cell along the minor axis.- Type
-
plot_centers¶ Painterparameter: IfTrue, only a dot at the center of eachRecordis painted instead of the polygon geometry.- Type
-
plot_confidences¶ Painterparameter: IfTrue, a label with the confidence is painted next to eachRecord.- Type
-
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.OrchestratorBaseMedium-level orchestrator which configure a
Compositorand aColorEnginefromDescriptorand 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 genericlayoutiterable 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) – ADescriptorto be used as primary descriptor in theColorEngine.secondary_descriptor (
Descriptor) – Optional. Default toNone. ADescriptorto be used as secondary descriptor in theColorEngine.zoom (float) – Optional. Default to
1. The zooming factor for eachTilein thelayout.title (str) – Optional. Default to
None. The composite figure global title, if provided.plot_centers (bool) – Optional. Default to
False. IfTrue, only a dot at the center of eachRecordis painted instead of the polygon geometry.plot_confidences (bool) – Optional. Deprecated (Superseded by
plot_tag). Defaults toFalse. IfTrue, a label with the confidence is painted next to eachRecord.plot_tag (
Descriptor) – Optional. Defaults toNone. Besides the geometry, display aRecorddescription in a tag attached to theRecord. Note that whileplot_confidencesis being deprecated, specifying it will overrideplot_tag.fill (bool) – Optional. Default to
False. A flag which represents whether to draw filled polygons.**kwargs (Any) – Additional parameters to set.
-
main_descriptor¶ ColorEngineparameter: ADescriptorto be used as primary descriptor.- Type
-
secondary_descriptor¶ ColorEngineparameter: ADescriptorto be used as secondary descriptor.- Type
-
n_cols¶ Compositorparameter: Number of data points per line to not exceed (if 1D array-like ofDataPoint).- Type
-
center¶ Compositorparameter: Center the last line of data points (if 1D array-like ofDataPoint).- Type
-
background_color¶ (
Compositor,LegendPainter) Background color to use for the mosaic and the legend.- Type
-
scale¶ LegendPainterparameter: Scale to use, regarding the default dimensions used.- Type
-
axis¶ LegendPainterparameter: Main direction of the legend (0 = vertically, 1 = horizontally)- Type
-
item_margins¶ LegendPainterparameter: Margins around the item (left/right and top/bottom).- Type
-
main_axis_align¶ LegendPainterparameter: Alignment of the item in its cell along the main axis.- Type
-
minor_axis_align¶ LegendPainterparameter: Alignment of the item in its cell along the minor axis.- Type
-
plot_centers¶ Painterparameter: IfTrue, only a dot at the center of eachRecordis painted instead of the polygon geometry.- Type
-
plot_tag¶ Painterparameter: Besides the geometry, display aRecorddescription in a tag attached to theRecord. Note that whileplot_confidencesis being deprecated, specifying it will overrideplot_tag.- Type
-
alpha¶ Painterparameter: A positive integer (between 0 and 255) that represents the fill transparency.- Type
-
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 ofTileandRecordCollectionto 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 ofDataPoint. 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