Link mark¶
Dome-shaped links connect paired positions and demonstrate interval-style relationships in a compact view.
Code¶
"""Link mark.
Dome-shaped links connect paired positions and demonstrate interval-style
relationships in a compact view.
"""
import genome_spy as gs
from genome_spy.datasets._grammar import link_data
# Load pairs of positions and a height for each link.
data = link_data()
# Connect each pair with an arc, using y to set its height.
chart = (
gs.Chart(data)
.mark_link(linkShape="dome", size=2)
.encode(
x=gs.X("x:Q").scale(domain=[0, 18], zoom=True).title("Start"),
x2=gs.X2("x2"),
y=gs.Y("y:Q").scale(domain=[0, 12]).title("Height"),
)
.properties(title="Dome-shaped links")
)