Ribbons

detroit.ribbon() Ribbon

Creates a new ribbon generator with the default settings.

Returns:

Ribbon generator

Return type:

Ribbon

detroit.ribbon_arrow() Ribbon

Creates a new arrow ribbon generator with the default settings. See also d3.chord_directed.

Returns:

Ribbon generator

Return type:

Ribbon

class detroit.chord.ribbon.Ribbon(head_radius: Callable[[...], float] | None = None)

Ribbon generator

Parameters:

head_radius (Callable[..., float] | None) – Arrow head radius accessor function

__call__(*args: Any) str | None

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

Parameters:

*args (Any) – Additional arguments passed through ribbon generator’s accessor methods

Returns:

Generated ribbon path

Return type:

str | None

set_head_radius(head_radius: Callable[[...], float] | float | None = None) Ribbon

Sets the arrowhead radius accessor to the specified function and returns this ribbon generator.

Parameters:

head_radius (Callable[..., float] | float | None) – Arrow head radius accessor function

Returns:

Itself

Return type:

Ribbon

set_radius(radius: Callable[[...], float] | float) Ribbon

Sets the source and target radius accessor to the specified function and returns this ribbon generator.

Parameters:

radius (Callable[..., float] | float) – Radius function or constant value

Returns:

Itself

Return type:

Ribbon

set_source_radius(source_radius: Callable[[...], float] | float) Ribbon

Sets the source radius accessor to the specified function and returns this ribbon generator.

Parameters:

source_radius (Callable[..., float] | float) – Source radius function

Returns:

Itself

Return type:

Ribbon

set_target_radius(target_radius: Callable[[...], float] | float) Ribbon

Sets the target radius accessor to the specified function and returns this ribbon generator.

Parameters:

target_radius (Callable[..., float] | float) – Target radius function

Returns:

Itself

Return type:

Ribbon

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

Sets the start angle accessor to the specified function and returns this ribbon generator.

Parameters:

start_angle (Callable[..., float] | float) – Start angle function or constant value

Returns:

Itself

Return type:

Ribbon

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

Sets the end angle accessor to the specified function and returns this ribbon generator.

Parameters:

end_angle (Callable[..., float] | float) – End angle function or constant value

Returns:

Itself

Return type:

Ribbon

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

Sets the pad angle accessor to the specified function and returns this ribbon generator

Parameters:

pad_angle (Callable[..., float] | float) – Pad angle function or constant value

Returns:

Itself

Return type:

Ribbon

set_source(source: Callable[[...], float] | float) Ribbon

Sets the source accessor to the specified function and returns this ribbon generator.

Parameters:

source (Callable[..., float] | float) – Source function or constant function

Returns:

Itself

Return type:

Ribbon

set_target(target: Callable[[...], float] | float) Ribbon

Sets the target accessor to the specified function and returns this ribbon generator.

Parameters:

target (Callable[..., float] | float) – Target function or constant function

Returns:

Itself

Return type:

Ribbon

set_context(context: Any | None = None) Ribbon

If context is specified, sets the context and returns this ribbon generator. If the context is not None, then the generated ribbon is rendered to this context as a sequence of path method calls. Otherwise, a path data string representing the generated ribbon is returned.

Parameters:

context (Any | None) – Context value

Returns:

Itself

Return type:

Ribbon