points#

Shapes made up of points.

class data_morph.shapes.points.Club(dataset: Dataset)[source]#

Bases: PointCollection

Class for the club shape.

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

This shape is generated using the panda dataset.#

Parameters:

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

distance(x: Number, y: Number) float#

Calculate the minimum distance from the points of this shape to a point (x, y).

Parameters:
Returns:

The minimum distance from the points of this shape to the point (x, y).

Return type:

float

classmethod get_name() str#

Get the name of the shape.

Returns:

The name of the shape.

Return type:

str

name: str | None = None#

The display name for the shape, if the lowercased class name is not desired.

plot(ax: Axes | None = None) Axes#

Plot the shape.

Parameters:

ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

points#

An array of (x, y) values representing an arrangement of points.

Type:

numpy.ndarray

class data_morph.shapes.points.DotsGrid(dataset: Dataset)[source]#

Bases: PointCollection

Class representing a 3x3 grid of dots.

../_images/data_morph-shapes-points-2.png

This shape is generated using the panda dataset.#

Parameters:

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

distance(x: Number, y: Number) float#

Calculate the minimum distance from the points of this shape to a point (x, y).

Parameters:
Returns:

The minimum distance from the points of this shape to the point (x, y).

Return type:

float

classmethod get_name() str#

Get the name of the shape.

Returns:

The name of the shape.

Return type:

str

name: str | None = 'dots'#

The display name for the shape, if the lowercased class name is not desired.

plot(ax: Axes | None = None) Axes#

Plot the shape.

Parameters:

ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

points#

An array of (x, y) values representing an arrangement of points.

Type:

numpy.ndarray

class data_morph.shapes.points.DownParabola(dataset: Dataset)[source]#

Bases: PointCollection

Class for the down parabola shape.

../_images/data_morph-shapes-points-3.png

This shape is generated using the panda dataset.#

Parameters:

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

distance(x: Number, y: Number) float#

Calculate the minimum distance from the points of this shape to a point (x, y).

Parameters:
Returns:

The minimum distance from the points of this shape to the point (x, y).

Return type:

float

classmethod get_name() str#

Get the name of the shape.

Returns:

The name of the shape.

Return type:

str

name: str | None = 'down_parab'#

The display name for the shape, if the lowercased class name is not desired.

plot(ax: Axes | None = None) Axes#

Plot the shape.

Parameters:

ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

points#

An array of (x, y) values representing an arrangement of points.

Type:

numpy.ndarray

class data_morph.shapes.points.Heart(dataset: Dataset)[source]#

Bases: PointCollection

Class for the heart shape.

../_images/data_morph-shapes-points-4.png

This shape is generated using the panda dataset.#

Parameters:

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

Notes

The formula for the heart shape is inspired by Heart Curve:

Weisstein, Eric W. “Heart Curve.” From MathWorld –A Wolfram Web Resource. https://mathworld.wolfram.com/HeartCurve.html

distance(x: Number, y: Number) float#

Calculate the minimum distance from the points of this shape to a point (x, y).

Parameters:
Returns:

The minimum distance from the points of this shape to the point (x, y).

Return type:

float

classmethod get_name() str#

Get the name of the shape.

Returns:

The name of the shape.

Return type:

str

name: str | None = None#

The display name for the shape, if the lowercased class name is not desired.

plot(ax: Axes | None = None) Axes#

Plot the shape.

Parameters:

ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

points#

An array of (x, y) values representing an arrangement of points.

Type:

numpy.ndarray

class data_morph.shapes.points.LeftParabola(dataset: Dataset)[source]#

Bases: PointCollection

Class for the left parabola shape.

../_images/data_morph-shapes-points-5.png

This shape is generated using the panda dataset.#

Parameters:

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

distance(x: Number, y: Number) float#

Calculate the minimum distance from the points of this shape to a point (x, y).

Parameters:
Returns:

The minimum distance from the points of this shape to the point (x, y).

Return type:

float

classmethod get_name() str#

Get the name of the shape.

Returns:

The name of the shape.

Return type:

str

name: str | None = 'left_parab'#

The display name for the shape, if the lowercased class name is not desired.

plot(ax: Axes | None = None) Axes#

Plot the shape.

Parameters:

ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

points#

An array of (x, y) values representing an arrangement of points.

Type:

numpy.ndarray

class data_morph.shapes.points.RightParabola(dataset: Dataset)[source]#

Bases: PointCollection

Class for the right parabola shape.

../_images/data_morph-shapes-points-6.png

This shape is generated using the panda dataset.#

Parameters:

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

distance(x: Number, y: Number) float#

Calculate the minimum distance from the points of this shape to a point (x, y).

Parameters:
Returns:

The minimum distance from the points of this shape to the point (x, y).

Return type:

float

classmethod get_name() str#

Get the name of the shape.

Returns:

The name of the shape.

Return type:

str

name: str | None = 'right_parab'#

The display name for the shape, if the lowercased class name is not desired.

plot(ax: Axes | None = None) Axes#

Plot the shape.

Parameters:

ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

points#

An array of (x, y) values representing an arrangement of points.

Type:

numpy.ndarray

class data_morph.shapes.points.Scatter(dataset: Dataset)[source]#

Bases: PointCollection

Class for the scatter shape: a cloud of randomly-scattered points.

../_images/data_morph-shapes-points-7.png

This shape is generated using the panda dataset.#

Parameters:

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

distance(x: Number, y: Number) int[source]#

No-op that allows returns 0 so that all perturbations are accepted.

Parameters:
  • x (int or float) – Coordinates of a point in 2D space.

  • y (int or float) – Coordinates of a point in 2D space.

Returns:

Always returns 0 to allow for scattering of the points.

Return type:

int

classmethod get_name() str#

Get the name of the shape.

Returns:

The name of the shape.

Return type:

str

name: str | None = None#

The display name for the shape, if the lowercased class name is not desired.

plot(ax: Axes | None = None) Axes#

Plot the shape.

Parameters:

ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

points#

An array of (x, y) values representing an arrangement of points.

Type:

numpy.ndarray

class data_morph.shapes.points.Spade(dataset: Dataset)[source]#

Bases: PointCollection

Class for the spade shape.

../_images/data_morph-shapes-points-8.png

This shape is generated using the panda dataset.#

Parameters:

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

distance(x: Number, y: Number) float#

Calculate the minimum distance from the points of this shape to a point (x, y).

Parameters:
Returns:

The minimum distance from the points of this shape to the point (x, y).

Return type:

float

classmethod get_name() str#

Get the name of the shape.

Returns:

The name of the shape.

Return type:

str

name: str | None = None#

The display name for the shape, if the lowercased class name is not desired.

plot(ax: Axes | None = None) Axes#

Plot the shape.

Parameters:

ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

points#

An array of (x, y) values representing an arrangement of points.

Type:

numpy.ndarray

class data_morph.shapes.points.UpParabola(dataset: Dataset)[source]#

Bases: PointCollection

Class for the up parabola shape.

../_images/data_morph-shapes-points-9.png

This shape is generated using the panda dataset.#

Parameters:

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

distance(x: Number, y: Number) float#

Calculate the minimum distance from the points of this shape to a point (x, y).

Parameters:
Returns:

The minimum distance from the points of this shape to the point (x, y).

Return type:

float

classmethod get_name() str#

Get the name of the shape.

Returns:

The name of the shape.

Return type:

str

name: str | None = 'up_parab'#

The display name for the shape, if the lowercased class name is not desired.

plot(ax: Axes | None = None) Axes#

Plot the shape.

Parameters:

ax (matplotlib.axes.Axes, optional) – An optional Axes object to plot on.

Returns:

The Axes object containing the plot.

Return type:

matplotlib.axes.Axes

points#

An array of (x, y) values representing an arrangement of points.

Type:

numpy.ndarray

Modules

club

Club shape.

dots_grid

Dots grid shape.

heart

Heart shape.

parabola

Parabola shapes.

scatter

Scatter shape.

spade

Spade shape.