circles#

Shapes that are circular in nature.

Classes

Bullseye(dataset)

Class representing a bullseye shape comprising two concentric circles.

Circle(dataset[, r])

Class representing a hollow circle.

Rings(dataset[, num_rings])

Class representing rings comprising multiple concentric circles.

class data_morph.shapes.circles.Bullseye(dataset: Dataset)[source]#

Bases: Rings

Class representing a bullseye shape comprising two concentric circles.

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

This shape is generated using the panda dataset.#

Parameters:

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

See also

Rings

The Bullseye is a special case where we only have 2 rings.

circles: list[Circle]#

The individual rings represented by Circle objects.

Type:

list[Circle]

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

Calculate the minimum absolute distance between any of this shape’s circles’ edges and a point (x, y).

Parameters:
Returns:

The minimum absolute distance between any of this shape’s circles’ edges and the point (x, y).

Return type:

float

See also

Circle.distance

Rings consists of multiple circles, so we use the minimum distance to one of the circles.

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

class data_morph.shapes.circles.Circle(dataset: Dataset, r: Number = None)[source]#

Bases: Shape

Class representing a hollow circle.

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

This shape is generated using the panda dataset.#

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

  • r (numbers.Number, optional) – The radius of the circle.

cx: Number#

The x coordinate of the circle’s center.

Type:

numbers.Number

cy: Number#

The y coordinate of the circle’s center.

Type:

numbers.Number

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

Calculate the absolute distance between this circle’s edge and a point (x, y).

Parameters:
Returns:

The absolute distance between this circle’s edge and the point (x, y).

Return type:

float

plot(ax: Axes = 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:

matplotlib.axes.Axes

r: Number#

The radius of the circle.

Type:

numbers.Number

class data_morph.shapes.circles.Rings(dataset: Dataset, num_rings: int = 4)[source]#

Bases: Shape

Class representing rings comprising multiple concentric circles.

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

This shape is generated using the panda dataset.#

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

  • num_rings (int, default 4) – The number of rings to include. Must be greater than 1.

See also

Circle

The individual rings are represented as circles.

circles: list[Circle]#

The individual rings represented by Circle objects.

Type:

list[Circle]

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

Calculate the minimum absolute distance between any of this shape’s circles’ edges and a point (x, y).

Parameters:
Returns:

The minimum absolute distance between any of this shape’s circles’ edges and the point (x, y).

Return type:

float

See also

Circle.distance

Rings consists of multiple circles, so we use the minimum distance to one of the circles.

plot(ax: Axes = 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:

matplotlib.axes.Axes