Radial Lines

detroit.line_radial() LineRadial

A radial line generator is like the Cartesian line generator except the x and y accessors are replaced with angle and radius accessors. Radial lines are positioned relative to the origin; use a transform to change the origin.

Returns:

Radial line generator

Return type:

LineRadial

class detroit.shape.line_radial.LineRadial
__call__(data: Iterable[T]) str | None

Generate a line for the given list of data

Parameters:

data (Iterable[T]) – Data values

Returns:

Generated line if the line is not associated to a context

Return type:

str | None

Examples

>>> svg.append("path").attr("d", line(data)).attr("stroke", "currentColor")
angle(angle: Callable[[T], float] | Callable[[T, int], float] | Callable[[T, int, list[Element]], float] | int | float) LineRadial

Sets angle accessor function

Parameters:

angle (Accessor[T, float] | Number) – angle accessor function

Returns:

Itself

Return type:

LineRadial

radius(radius: Callable[[T], float] | Callable[[T, int], float] | Callable[[T, int, list[Element]], float] | int | float) LineRadial

Sets radius accessor function

Parameters:

radius (Accessor[T, float] | Number) – radius accessor function

Returns:

Itself

Return type:

LineRadial

set_defined(defined: Callable[[T], bool] | Callable[[T, int], bool] | Callable[[T, int, list[Element]], bool] | int | float) Line

Sets defined accessor

When a line is generated, the defined accessor will be invoked for each element in the input data array, being passed the element d, the index i, and the array data as three arguments. If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), the x and y accessors will subsequently be evaluated and the point will be added to the current line segment. Otherwise, the element will be skipped, the current line segment will be ended, and a new line segment will be generated for the next defined point.

Parameters:

defined (Accessor[T, bool] | Number) – defined accessor function

Returns:

Itself

Return type:

Line

set_curve(curve: Callable[[Path], Curve]) LineRadial

Sets curve.

Parameters:

curve (Callable[[Path], Curve]) – Curve factory function

Returns:

Itself

Return type:

LineRadial

set_context(context: Path | None = None) Line

Sets the context.

Parameters:

context (Path | None) – Path

Returns:

Itself

Return type:

Line