points#
Shapes that are composed of points.
Classes
|
Class representing a 3x3 grid of dots. |
|
Class for the down parabola shape. |
|
Class for the heart shape. |
|
Class for the left parabola shape. |
|
Class for the right parabola shape. |
|
Class for the scatter shape: a cloud of randomly-scattered points. |
|
Class for the up parabola shape. |
- class data_morph.shapes.points.DotsGrid(dataset: Dataset)[source]#
Bases:
PointCollection
Class representing a 3x3 grid of dots.
- 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:
x (numbers.Number) – Coordinates of a point in 2D space.
y (numbers.Number) – Coordinates of a point in 2D space.
- Returns:
The minimum distance from the points of this shape to the point (x, y).
- Return type:
- plot(ax: Axes = 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:
- points#
An array of (x, y) values representing an arrangement of points.
- Type:
- class data_morph.shapes.points.DownParabola(dataset: Dataset)[source]#
Bases:
PointCollection
Class for the down parabola shape.
- 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:
x (numbers.Number) – Coordinates of a point in 2D space.
y (numbers.Number) – Coordinates of a point in 2D space.
- Returns:
The minimum distance from the points of this shape to the point (x, y).
- Return type:
- plot(ax: Axes = 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:
- points#
An array of (x, y) values representing an arrangement of points.
- Type:
- class data_morph.shapes.points.Heart(dataset: Dataset)[source]#
Bases:
PointCollection
Class for the heart shape.
- 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:
x (numbers.Number) – Coordinates of a point in 2D space.
y (numbers.Number) – Coordinates of a point in 2D space.
- Returns:
The minimum distance from the points of this shape to the point (x, y).
- Return type:
- plot(ax: Axes = 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:
- points#
An array of (x, y) values representing an arrangement of points.
- Type:
- class data_morph.shapes.points.LeftParabola(dataset: Dataset)[source]#
Bases:
PointCollection
Class for the left parabola shape.
- 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:
x (numbers.Number) – Coordinates of a point in 2D space.
y (numbers.Number) – Coordinates of a point in 2D space.
- Returns:
The minimum distance from the points of this shape to the point (x, y).
- Return type:
- plot(ax: Axes = 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:
- points#
An array of (x, y) values representing an arrangement of points.
- Type:
- class data_morph.shapes.points.RightParabola(dataset: Dataset)[source]#
Bases:
PointCollection
Class for the right parabola shape.
- 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:
x (numbers.Number) – Coordinates of a point in 2D space.
y (numbers.Number) – Coordinates of a point in 2D space.
- Returns:
The minimum distance from the points of this shape to the point (x, y).
- Return type:
- plot(ax: Axes = 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:
- points#
An array of (x, y) values representing an arrangement of points.
- Type:
- class data_morph.shapes.points.Scatter(dataset: Dataset)[source]#
Bases:
PointCollection
Class for the scatter shape: a cloud of randomly-scattered points.
- 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.
- plot(ax: Axes = 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:
- points#
An array of (x, y) values representing an arrangement of points.
- Type:
- class data_morph.shapes.points.UpParabola(dataset: Dataset)[source]#
Bases:
PointCollection
Class for the up parabola shape.
- 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:
x (numbers.Number) – Coordinates of a point in 2D space.
y (numbers.Number) – Coordinates of a point in 2D space.
- Returns:
The minimum distance from the points of this shape to the point (x, y).
- Return type:
- plot(ax: Axes = 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:
- points#
An array of (x, y) values representing an arrangement of points.
- Type: