Arcs

detroit.arc()

The arc generator produces a circular or annular sector, as in a pie or donut chart. Arcs are centered at the origin; use a transform to move the arc to a different position

Examples

>>> from math import pi
>>> arc = d3.arc()
...     .set_inner_radius(0)
...     .set_outer_radius(100)
...     .set_start_angle(0)
...     .set_end_angle(pi / 2)
class detroit.shape.arc.Arc

The arc generator produces a circular or annular sector, as in a pie or donut chart. Arcs are centered at the origin; use a transform to move the arc to a different position

Examples

>>> from math import pi
>>> arc = d3.arc()
...     .set_inner_radius(0)
...     .set_outer_radius(100)
...     .set_start_angle(0)
...     .set_end_angle(pi / 2)
__call__(*args) str | None

Generates an arc for the given arguments. The arguments are arbitrary; they are propagated to the arc generator’s accessor functions along with the this object.

Parameters:

args (Any) – Additional arguments

Returns:

Generated arc if the arc is not associated to a context

Return type:

str | None

Examples

>>> from math import pi
>>> d3.arc()
...     .set_inner_radius(0)
...     .set_outer_radius(100)
...     .set_start_angle(0)
...     .set_end_angle(pi / 2)()
centroid(*args) tuple[float, float]

Computes the midpoint [x, y] of the center line of the arc that would be generated by the given arguments.

Parameters:

args (Any) – Additional arguments

Returns:

Midpoint coordinates

Return type:

tuple[float, float]

set_inner_radius(inner_radius: Callable[[...], float] | float | int) Arc

If radius is specified, sets the inner radius to the specified function or number and returns this arc generator.

Parameters:

inner_radius (Callable[..., float] | float | int) – Inner radius

Returns:

Itself

Return type:

Arc

set_outer_radius(outer_radius: Callable[[...], float] | float | int) Arc

If radius is specified, sets the outer radius to the specified function or number and returns this arc generator.

Parameters:

outer_radius (Callable[..., float] | float | int) – Outer radius

Returns:

Itself

Return type:

Arc

set_corner_radius(corner_radius: Callable[[...], float] | float | int) Arc

If angle is specified, sets the corner angle to the specified function or number and returns this arc generator.

Parameters:

corner_radius (Callable[..., float] | float | int) – Corner radius

Returns:

Itself

Return type:

Arc

set_pad_radius(pad_radius: Callable[[...], float] | float | int | None = None) Arc

If angle is specified, sets the pad radius to the specified function or number and returns this arc generator.

Parameters:

pad_radius (Callable[..., float] | float | int | None) – Pad radius

Returns:

Itself

Return type:

Arc

set_start_angle(start_angle: Callable[[...], float] | float | int) Arc

If angle is specified, sets the start angle to the specified function or number and returns this arc generator.

Parameters:

start_angle (Callable[..., float] | float | int) – Start angle

Returns:

Itself

Return type:

Arc

set_end_angle(end_angle: Callable[[...], float] | float | int) Arc

If angle is specified, sets the end angle to the specified function or number and returns this arc generator.

Parameters:

end_angle (Callable[..., float] | float | int) – End angle

Returns:

Itself

Return type:

Arc

set_pad_angle(pad_angle: Callable[[...], float] | float | int) Arc

If angle is specified, sets the pad angle to the specified function or number and returns this arc generator.

Parameters:

pad_angle (Callable[..., float] | float | int) – Pad angle

Returns:

Itself

Return type:

Arc

set_context(context: Selection | None = None) Arc

If context is specified, sets the context and returns this arc generator.

Parameters:

context (Selection | None) – Context

Returns:

Itself

Return type:

Arc