c.sectors / pt.Sectors
Coordinates & layout
Minimal call
import random
rng = random.Random(4)
regions = {"promoter": 100, "gene body": 400, "UTR": 150}
data = {"region": [], "pos": [], "signal": []}
for name, length in regions.items():
for _ in range(12):
data["region"].append(name)
data["pos"].append(rng.uniform(0, length))
data["signal"].append(rng.uniform(0.2, 0.9))
c = pt.chart(data, aes(x="pos", y="signal"), data_width=460,
data_height=130, ylim=(0, 1), ylabel="signal")
c.sectors(regions, column="region")
c.add_scatter(size=3, color="#534AB7")
Docstring
Immutable, ordered partition of an axis.
Exactly one of ``lengths`` or ``members`` is set, picked by the
construction shape. ``kind`` is derived.
``gap`` is the inter-sector pixel pad. For categorical sectors it
becomes the ``_CategoryScale`` ``split_gap``. ``None`` means "use the
spec default" (``defaults.category_split_gap``).
``divider`` toggles the wall lines between sectors; ``label`` toggles
the sector-name labels. Both False is the heatmap-clustering case
(sectors drive layout only, no visible chrome). Wall *styling* lives
on ``c.spines(walls={...})``.