Signal resolution

Aesthetics

This page focuses on choices you can see: signal styles, color grouping, label placement, and shared scales. For exhaustive runtime fields, use Compact Options.

BigWig styles

style changes how a quantitative signal is drawn.

from plotnado import GenomicFigure
from plotnado.examples import REGION, signal
# signal() returns a synthetic ChIP-seq-like DataFrame(chrom, start, end, value)
# In real use pass a BigWig path/URL or any DataFrame with those columns
# REGION is a string like "chr1:1,000,000-1,100,000"


fig = GenomicFigure(track_height=1.15)
fig.scalebar()
fig.bigwig(signal(phase=0.0), title="fill", style="fill", color="#1f77b4")
fig.bigwig(signal(phase=0.8), title="fragment", style="fragment", color="#d62728")
fig.bigwig(signal(phase=1.6), title="scatter", style="scatter", color="#2ca02c", scatter_point_size=10)
fig.bigwig(signal(phase=2.4), title="std", style="std", color="#9467bd")
fig.plot(REGION)

fill is the default for continuous signal, fragment emphasizes bins, scatter shows individual values, and std draws a band-style summary.

n_bins divides the plotted region into a fixed number of equal bins regardless of the source resolution. bin_size sets the bin width in base pairs instead. Both work with BigWig files and DataFrames; overlapping source intervals are averaged by overlap length.

from plotnado import GenomicFigure
from plotnado.examples import REGION, signal
# signal() returns a synthetic ChIP-seq-like DataFrame(chrom, start, end, value) at 200 bp bins
# In real use pass a BigWig path/URL or any DataFrame with those columns

fig = GenomicFigure(track_height=1.15)
fig.scalebar()
fig.bigwig(signal(), title="bin_size=5000 (coarse)", style="fill", color="#9467bd", bin_size=5000)
fig.bigwig(signal(), title="bin_size=1000",           style="fill", color="#d62728", bin_size=1000)
fig.bigwig(signal(), title="bin_size=200 (native)",   style="fill", color="#1f77b4")
fig.bigwig(signal(), title="n_bins=50",                 style="fill", color="#2ca02c", n_bins=50)
fig.bigwig(signal(), title="n_bins=200",                style="fill", color="#ff7f0e", n_bins=200)
fig.axis()
fig.plot(REGION)

Coarser binning compresses the signal into broader summaries; finer bins preserve peak shape. The bottom track is the native 200 bp resolution from the synthetic data.

Use n_bins when you want consistent resolution across regions of different sizes:

# Always 200 bins regardless of zoom level
fig.bigwig("signal.bw", n_bins=200)

# Fixed bin width across any region
fig.bigwig("signal.bw", bin_size=500)

Color and alpha

from plotnado import GenomicFigure
from plotnado.examples import REGION, signal
# signal() → DataFrame(chrom, start, end, value) — replace with a BigWig path/URL or DataFrame

fig = GenomicFigure(track_height=1.0)
fig.bigwig(signal(), title="alpha=1.0", style="fill", color="#1f77b4", alpha=1.0)
fig.bigwig(signal(phase=0.8), title="alpha=0.65", style="fill", color="#d62728", alpha=0.65)
fig.bigwig(signal(phase=1.6), title="alpha=0.35", style="fill", color="#2ca02c", alpha=0.35)
fig.plot(REGION)

Use opacity to reduce visual dominance when several panels are compared.

Autocolor and groups

Use autocolor() once, then assign related tracks the same color_group.

from plotnado import GenomicFigure
from plotnado.examples import REGION, intervals, signal
# signal() → DataFrame(chrom, start, end, value) — replace with a BigWig path/URL or DataFrame
# intervals() → DataFrame(chrom, start, end, name) — replace with a BED/BigBed path, URL, or DataFrame

fig = GenomicFigure(track_height=1.1).autocolor("Set2")
fig.bigwig(signal(phase=0.0), title="Sample A signal", color_group="A")
fig.bed(intervals(), title="Sample A peaks", color_group="A", display="expanded")
fig.bigwig(signal(phase=1.2), title="Sample B signal", color_group="B")
fig.bed(intervals().assign(name=["b1", "b2", "b3", "b4"]), title="Sample B peaks", color_group="B", display="expanded")
fig.plot(REGION)

Color groups keep semantically related tracks aligned without hard-coding every color.

Label placement

from plotnado import GenomicFigure
from plotnado.examples import REGION, signal
# signal() → DataFrame(chrom, start, end, value) — replace with a BigWig path/URL or DataFrame

fig = GenomicFigure(track_height=1.0)
fig.bigwig(signal(),           title="title_location='left'",                       title_location="left")
fig.bigwig(signal(phase=0.7),  title="title_location='right'",                      title_location="right")
fig.bigwig(signal(phase=1.4),  title="label_on_track, no box",                      label_on_track=True, label_box_enabled=False)
fig.bigwig(signal(phase=2.1),  title="label_on_track + label_box_enabled",          label_on_track=True, label_box_enabled=True)
fig.plot(REGION)

title_location anchors the label left or right; label_box_enabled adds a legibility box; label_on_track with the box is useful for compact multi-track figures.

Overlay, autoscale, and highlights

from plotnado import GenomicFigure
from plotnado.examples import REGION, review_signal
# review_signal() → DataFrame(chrom, start, end, value) — replace with BigWig paths/URLs or DataFrames

signal_a = review_signal(2.0)
signal_b = review_signal(10.0, 1.2)


fig = GenomicFigure(track_height=1.2)
fig.autoscale(True)
fig.highlight("chr1:1,032,000-1,046,000")
fig.highlight_style(color="#ffdd57", alpha=0.22)
fig.bigwig(signal_a, title="Control", autoscale_group="signal", color="#1f77b4")
fig.bigwig(signal_b, title="Treatment", autoscale_group="signal", color="#d62728")
fig.overlay(
    [signal_a, signal_b],
    title="Overlay",
    autoscale_group="signal",
    colors=["#1f77b4", "#d62728"],
    alpha=0.55,
)
fig.plot(REGION)

highlight() marks a locus without changing y-limits; autoscale_group on the overlay synchronizes the panel with neighboring signal tracks.

Themes

from plotnado import GenomicFigure
from plotnado.examples import signal, REGION

fig = GenomicFigure(theme="publication")
fig.scalebar()
fig.bigwig(signal(), title="Publication theme", style="fill", color="#1f77b4")
fig.axis()
fig.plot("chr1:1,000,000-1,100,000", show=True)

fig = GenomicFigure(theme="minimal")
fig.scalebar()
fig.bigwig(signal(), title="Minimal theme", style="fill", color="#1f77b4")
fig.axis()
fig.plot("chr1:1,000,000-1,100,000", show=False)

Built-in themes include "default", "minimal", and "publication".

Signal smoothing

smoothing_window applies a rolling window over the binned signal before rendering. smoothing_method selects "mean" (default) or "median". Set smoothing_center=True (default) to center the window so peaks stay aligned with their genomic position. With a large median window, broad peaks can develop flat tops because many adjacent bins share the same median; that shape is expected and is not y-axis clipping.

from plotnado import GenomicFigure
from plotnado.examples import REGION, signal

fig = GenomicFigure(track_height=1.15)
fig.scalebar()
fig.bigwig(signal(), title="raw", style="fill", color="#aec7e8", autoscale_group='signal')
fig.bigwig(signal(), title="smoothing_window=50, mean", style="fill", color="#1f77b4",
           smoothing_window=50, smoothing_method="mean", autoscale_group='signal')
fig.bigwig(signal(), title="smoothing_window=50, median", style="fill", color="#d62728",
           smoothing_window=50, smoothing_method="median", autoscale_group='signal')
fig.axis()
fig.plot(REGION)

A window of 50 bins visibly smooths noisy signal while preserving peak position; median smoothing is more robust to spikes, and with a large window it can produce flat-topped peaks by design.

Threshold and coordinate markers

hline draws a horizontal line at a fixed y-value — useful for significance thresholds or baseline references. vline draws a vertical line at a fixed genomic coordinate. Both are zero-height overlay tracks so they do not consume panel space.

from plotnado import GenomicFigure
from plotnado.examples import REGION, signal

fig = GenomicFigure(track_height=1.3)
fig.scalebar()
fig.hline(3.0, color="#d62728", linestyle="--", linewidth=1.2, alpha=0.8)
fig.vline("chr1:1,044,000", color="#2ca02c", linestyle=":", linewidth=1.5, alpha=0.9)
fig.bigwig(signal(scale=6.0), title="signal with markers", style="fill", color="#1f77b4")
fig.axis()
fig.plot(REGION)

hline marks a threshold across the full panel width; vline marks a specific genomic position.

Key options for both tracks:

Option Default Effect
color "steelblue" Line color.
linestyle "--" Any matplotlib linestyle: "-", "--", "-.", ":".
linewidth 1.0 Line width in points.
alpha 1.0 Opacity.
zorder 10 Rendering layer; higher values draw on top.

BigWig difference options

bigwig_diff computes a per-bin difference between two BigWig files. The method parameter controls the arithmetic:

method Formula
"subtract" (default) A − B
"ratio" A / B
"log2ratio" log₂(A / B)

Positive and negative bars are colored independently. The zero baseline is also configurable. Both file paths and in-memory DataFrames are accepted:

from plotnado import GenomicFigure
from plotnado.examples import REGION, signal

a = signal(scale=4.0, phase=0.0)
b = signal(scale=2.0, phase=0.8)

fig = GenomicFigure(track_height=1.4)
fig.scalebar()
fig.bigwig(a, title="Control", color="#1f77b4")
fig.bigwig(b, title="Treatment", color="#d62728")
fig.bigwig_diff(a, b, title="subtract (default)", method="subtract",
                positive_color="#d62728", negative_color="#1f77b4", bar_alpha=0.6)
fig.bigwig_diff(a, b, title="log2ratio",         method="log2ratio",
                positive_color="#e67e22", negative_color="#8e44ad", bar_alpha=0.6)
fig.axis()
fig.plot(REGION)

Subtract (default) shows raw difference; log2ratio compresses dynamic range. Positive bars use positive_color, negative use negative_color.

BigWig collection style and labels

bigwig_collection renders multiple BigWig files in a single panel. Use style to choose how they are arranged:

style Behaviour
"overlay" (default) All series share one y-axis, drawn on top of each other.
"stacked" Each series occupies its own horizontal band.

labels assigns a per-file legend label; falls back to filenames when omitted.

files = ["sample_a.bw", "sample_b.bw", "sample_c.bw"]

# Overlay — useful for direct comparison
fig.bigwig_collection(files, title="Samples", style="overlay",
                      labels=["Control", "Treatment A", "Treatment B"],
                      colors=["#1f77b4", "#d62728", "#2ca02c"])

# Stacked — useful for many samples
fig.bigwig_collection(files, title="Samples", style="stacked")

Gene label strategies

label_overlap_strategy controls what happens when two gene name labels would overlap horizontally:

Strategy Behaviour
"auto" (default) Resolves to "smart" in most cases.
"smart" Stacks labels into extra lanes above the gene row, using horizontal nudging where possible.
"stagger" Alternates labels between two fixed vertical offsets.
"suppress" Hides the second label entirely when a collision is detected.
"auto_expand" Switches the whole track from collapsed to expanded display when collisions occur.
from plotnado import GenomicFigure
from plotnado.examples import WIDE_REGION

fig = GenomicFigure(track_height=1.4)
fig.scalebar()
fig.genes("hg38", title="smart (default)", label_overlap_strategy="smart")
fig.genes("hg38", title="suppress", label_overlap_strategy="suppress")
fig.genes("hg38", title="stagger", label_overlap_strategy="stagger")
fig.axis()
fig.plot(WIDE_REGION)

smart (default) nudges colliding labels upward into lanes; suppress silently drops them; stagger alternates heights.

gene_label_style sets the font style for gene names:

from plotnado import GenomicFigure
from plotnado.examples import WIDE_REGION

fig = GenomicFigure(track_height=1.4)
fig.scalebar()
fig.genes("hg38", title="italic (default)", gene_label_style="italic")
fig.genes("hg38", title="normal", gene_label_style="normal")
fig.axis()
fig.plot(WIDE_REGION)

Italic (default) distinguishes gene names from surrounding annotation text; normal and oblique are alternatives.

Axis human-readable labels

Set use_human_readable_labels=True to display tick labels with k / M / G suffixes instead of raw base-pair numbers. Useful for large regions where raw numbers become hard to read.

from plotnado import GenomicFigure
from plotnado.examples import signal

LONG_REGION = "chr1:1,000,000-2,000,000"

fig = GenomicFigure(track_height=0.8)
fig.bigwig(signal(), title="raw bp ticks")
fig.axis(use_human_readable_labels=False)
fig.bigwig(signal(), title="k/M ticks")
fig.axis(use_human_readable_labels=True)
fig.plot(LONG_REGION)

Human-readable labels (bottom) keep the axis uncluttered over large regions.