Skip to content

Sector Class

pycirclizely.sector.Sector

Sector(
    name: str,
    size: float | tuple[float, float],
    rad_lim: tuple[float, float],
    clockwise: bool = True,
)

Circos Sector Class

Parameters:

Name Type Description Default
name str

Sector name.

required
size float | tuple[float, float]

Sector size (or range).

required
rad_lim tuple[float, float]

Sector radian limit region.

required
clockwise bool

Sector coordinate direction (clockwise or anti-clockwise).

True

Methods:

Name Description
add_track

Args:

axis

Plot axis shapes for the sector.

get_lowest_r

Get lowest radius position of sector from tracks data.

get_track

Get track instance by name.

line

Plot line with sector-relative coordinates.

rect

Plot a rectangle spanning angular and radial ranges.

text

Plot text within a sector. Uses genomic coordinates (x) mapped to radians.

x_to_rad

Convert x coordinate to radian in sector start-end range.

Attributes

annotations property

annotations: list[Annotation]

Layout annotations

center property

center: float

Sector center position (x coordinate)

clockwise property

clockwise: bool

Sector coordinate direction

deg_lim property

deg_lim: tuple[float, float]

Sector degree limit

deg_size property

deg_size: float

Sector degree size

end property

end: float

Sector end position (x coordinate)

name property

name: str

Sector name

rad_lim property

rad_lim: tuple[float, float]

Sector radian limit

rad_size property

rad_size: float

Sector radian size

shapes property

shapes: list[Shape]

Layout shapes

size property

size: float

Sector size (x coordinate)

start property

start: float

Sector start position (x coordinate)

traces property

traces: list[BaseTraceType]

Data traces

tracks property

tracks: list[Track]

Tracks in sector

Functions

add_track

add_track(
    r_lim: tuple[float, float],
    *,
    r_pad_ratio: float = 0,
    name: str | None = None
) -> Track

Parameters:

Name Type Description Default
r_lim tuple[float, float]

Radius limit region.

required
r_pad_ratio float

Track padding ratio for plot data.

0
name str | None

Track name. If None, a default name is generated.

None

axis

axis(**kwargs: Any) -> None

Plot axis shapes for the sector.

Parameters:

Name Type Description Default
**kwargs Any {}

get_lowest_r

get_lowest_r() -> float

Get lowest radius position of sector from tracks data.

get_track

get_track(name: str) -> Track

Get track instance by name.

line

line(
    *,
    r: float | tuple[float, float],
    start: float | None = None,
    end: float | None = None,
    arc: bool = True,
    **kwargs: Any
) -> None

Plot line with sector-relative coordinates.

Parameters:

Name Type Description Default
r float | tuple[float, float]

Radius position(s). If float, creates constant-radius line.

required
start float | None

Genomic start position. Uses sector start if None.

None
end float | None

Genomic end position. Uses sector end if None.

None
arc bool

If True, creates curved arc line (polar projection). If False, creates straight chord line.

True
**kwargs Any

Shape properties (e.g. line=dict(color="red", width=2, dash="dash")). https://plotly.com/python/reference/layout/shapes/

{}

rect

rect(
    start: int | float | None = None,
    end: int | float | None = None,
    r_lim: tuple[float, float] | None = None,
    **kwargs: Any
) -> None

Plot a rectangle spanning angular and radial ranges.

Parameters:

Name Type Description Default
start int | float | None

Start position (x coordinate). If None, sector.start is set.

None
end int | float | None

End position (x coordinate). If None, sector.end is set.

None
r_lim tuple[float, float] | None

Radius limit region. If None, (0, 100) is set.

None
**kwargs Any

Shape properties (e.g. fillcolor="red", line: {color: "blue", width: 2, ... } ...) https://plotly.com/python/reference/layout/shapes/

{}

text

text(
    text: str,
    x: float | None = None,
    r: float = 107,
    *,
    adjust_rotation: bool = True,
    orientation: str = "horizontal",
    ignore_range_error: bool = False,
    **kwargs: Any
) -> None

Plot text within a sector. Uses genomic coordinates (x) mapped to radians.

Parameters:

Name Type Description Default
text str

Text content.

required
x float | None

Genomic position. If None, sector center is used.

None
r float

Radius position (default: 105, outer edge).

107
adjust_rotation bool

If True, text rotation auto based on x and orientation.

True
orientation str

Text orientation (horizontal or vertical).

'horizontal'
ignore_range_error bool

If True, ignores x position outside sector bounds.

False
**kwargs Any

Annotation properties (e.g. font=dict(size=12, color='red')). https://plotly.com/python/reference/layout/annotations/

{}

x_to_rad

x_to_rad(
    x: float, ignore_range_error: bool = False
) -> float

Convert x coordinate to radian in sector start-end range.

Parameters:

Name Type Description Default
x float

X coordinate.

required
ignore_range_error bool

Ignore x coordinate range error.

False