factory#

Factory class for generating shape objects.

Classes

ShapeFactory(dataset)

Factory for generating shape objects based on data.

class data_morph.shapes.factory.ShapeFactory(dataset: Dataset)[source]#

Bases: object

Factory for generating shape objects based on data.

../_images/data_morph-shapes-factory-1.png

Target shapes currently available.#

Parameters:

dataset (Dataset) – The starting dataset to morph into other shapes.

AVAILABLE_SHAPES: list[str] = ['bullseye', 'circle', 'diamond', 'dots', 'down_parab', 'h_lines', 'heart', 'high_lines', 'left_parab', 'rectangle', 'right_parab', 'rings', 'scatter', 'slant_down', 'slant_up', 'star', 'up_parab', 'v_lines', 'wide_lines', 'x']#

The list of available shapes, which can be visualized with plot_available_shapes().

Type:

list[str]

generate_shape(shape: str, **kwargs) Shape[source]#

Generate the shape object based on the dataset.

Parameters:
  • shape (str) – The desired shape. See AVAILABLE_SHAPES.

  • **kwargs – Additional keyword arguments to pass down when creating the shape.

Returns:

An shape object of the requested type.

Return type:

Shape

plot_available_shapes() Axes[source]#

Plot the available target shapes.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

See also

AVAILABLE_SHAPES

The list of available shapes.