Skip to content

Sector Class

Sector

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

Circos Sector Class

PARAMETER DESCRIPTION
name

Sector name

TYPE: str

size

Sector size

TYPE: float

rad_lim

Sector radian limit region

TYPE: tuple[float, float]

start_pos

Sector start position

TYPE: float DEFAULT: 0

clockwise

Sector coordinate direction (clockwise or anti-clockwise).

TYPE: bool DEFAULT: True

name property

name: str

Sector name

size property

size: float

Sector size (x coordinate)

start property

start: float

Sector start position (x coordinate)

end property

end: float

Sector end position (x coordinate)

center property

center: float

Sector center position (x coordinate)

rad_size property

rad_size: float

Sector radian size

rad_lim property

rad_lim: tuple[float, float]

Sector radian limit

deg_size property

deg_size: float

Sector degree size

deg_lim property

deg_lim: tuple[float, float]

Sector degree limit

clockwise property

clockwise: bool

Sector coordinate direction

tracks property

tracks: list[Track]

Tracks in sector

patches property

patches: list[Patch]

Plot patches

plot_funcs property

plot_funcs: list[Callable[[PolarAxes], None]]

Plot functions

add_track

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

Add track to sector

PARAMETER DESCRIPTION
r_lim

Radius limit region (0 - 100)

TYPE: tuple[float, float]

r_pad_ratio

Radius padding ratio for plot data (0 - 1.0)

TYPE: float DEFAULT: 0

name

Track name. If None, Track{track_idx} is set.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
track

Track

TYPE: Track

get_track

get_track(name: str) -> Track

Get track by name

PARAMETER DESCRIPTION
name

Track name

TYPE: str

RETURNS DESCRIPTION
track

Target name track

TYPE: Track

get_lowest_r

get_lowest_r() -> float

Get lowest radius position of sector from tracks data

RETURNS DESCRIPTION
lowest_r

Lowest radius position. If no tracks found, lowest_r=100.

TYPE: float

x_to_rad

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

Convert x coordinate to radian in sector start-end range

PARAMETER DESCRIPTION
x

X coordinate

TYPE: float

ignore_range_error

Ignore x coordinate range error

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
rad

Radian coordinate

TYPE: float

axis

axis(**kwargs) -> None

Plot axis

By default, simple black axis params(fc="none", ec="black", lw=0.5) are set.

PARAMETER DESCRIPTION
**kwargs

Patch properties (e.g. fc="red", ec="blue", lw=0.5, ...) https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Patch.html

TYPE: dict DEFAULT: {}

text

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

Plot text

PARAMETER DESCRIPTION
text

Text content

TYPE: str

x

X position. If None, sector center x is set.

TYPE: float | None DEFAULT: None

r

Radius position. By default, outer position r=105 is set.

TYPE: float DEFAULT: 105

adjust_rotation

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

TYPE: bool DEFAULT: True

orientation

Text orientation (horizontal or vertical)

TYPE: str DEFAULT: 'horizontal'

ignore_range_error

If True, ignore x position range error (ErrorCase: not track.start <= x <= track.end)

TYPE: bool DEFAULT: False

**kwargs

Text properties (e.g. size=12, color="red", va="center", ...) https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.text.html

TYPE: dict DEFAULT: {}

line

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

Plot line

PARAMETER DESCRIPTION
r

Line radius position (0 - 100). If r is float, (r, r) is set.

TYPE: float | tuple[float, float]

start

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

TYPE: float | None DEFAULT: None

end

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

TYPE: float | None DEFAULT: None

arc

If True, plot arc style line for polar projection. If False, simply plot linear style line.

TYPE: bool DEFAULT: True

**kwargs

Patch properties (e.g. color="red", lw=3, ...) https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Patch.html

TYPE: dict DEFAULT: {}

rect

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

Plot rectangle

PARAMETER DESCRIPTION
start

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

TYPE: float | None DEFAULT: None

end

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

TYPE: float | None DEFAULT: None

r_lim

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

TYPE: tuple[float, float] | None DEFAULT: None

**kwargs

Patch properties (e.g. fc="red", ec="blue", lw=1.0, ...) https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Patch.html

TYPE: dict DEFAULT: {}

raster

raster(
    img: str | Path | Image.Image,
    *,
    size: float = 0.05,
    x: float | None = None,
    r: float = 105,
    rotation: int | float | str | None = None,
    border_width: int = 0,
    label: str | None = None,
    label_pos: str = "bottom",
    label_margin: float = 0.1,
    imshow_kws: dict[str, Any] | None = None,
    text_kws: dict[str, Any] | None = None
) -> None

Plot raster image

This method is experimental. API may change in the future release.

PARAMETER DESCRIPTION
img

Image for plotting (File Path|URL|PIL Image)

TYPE: str | Path | Image

size

Image size (ratio to overall figure size)

TYPE: float DEFAULT: 0.05

x

X position. If None, sector center x position is set.

TYPE: float | None DEFAULT: None

r

Radius position

TYPE: float DEFAULT: 105

rotation

Image rotation setting. If None, no rotate image (default). If auto, rotate image by auto set rotation. If int or float value, rotate image by user-specified value.

TYPE: int | float | str | None DEFAULT: None

border_width

Border width in pixel. By default, 0 is set (no border shown).

TYPE: int DEFAULT: 0

label

Image label. If None, no label shown.

TYPE: str | None DEFAULT: None

label_pos

Label plot position (bottom or top)

TYPE: str DEFAULT: 'bottom'

label_margin

Label margin

TYPE: float DEFAULT: 0.1

imshow_kws

TYPE: dict[str, Any] | None DEFAULT: None

text_kws

Text properties (e.g. dict(size=10, color="red", ...) https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.text.html

TYPE: dict[str, Any] | None DEFAULT: None