Heart#

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

Bases: PointCollection

Class for the heart shape.

../_images/data_morph-shapes-points-Heart-1.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

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:

matplotlib.axes.Axes

points#

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

Type:

numpy.ndarray