Shape#
- class data_morph.shapes.bases.shape.Shape[source]#
Bases:
ABC
Abstract base class for a shape.
- abstract distance(x: Number, y: Number) float [source]#
Calculate the distance between this shape and 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 distance between this shape and the point (x, y).
- Return type:
- classmethod get_name() str [source]#
Get the name of the shape.
- Returns:
The name of the shape.
- Return type:
- name: str | None = None#
The display name for the shape, if the lowercased class name is not desired.
- abstract plot(ax: Axes | None = None) Axes [source]#
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:
Notes
When implementing this method for subclasses, make sure to apply the
plotting.style.plot_with_custom_style()
decorator.