Options Reference
OncoplotOptions controls layout and visual details. Pass it through the
options argument:
from pyoncoplot import OncoplotOptions, oncoplot
result = oncoplot(
mutations,
gene_col="gene",
sample_col="sample",
mutation_type_col="mutation_type",
backend="matplotlib",
options=OncoplotOptions(width=1200, height=700),
)
Size and Layout
Option |
Default |
Meaning |
|---|---|---|
|
|
intended output width in pixels |
|
|
intended output height in pixels |
|
|
Plotly selection mode: |
|
|
relative height of the TMB bar area |
|
|
relative width of the right gene bar |
|
|
relative height of metadata tracks |
|
|
|
|
|
spacing around metadata tracks |
|
|
spacing around the TMB bar |
|
|
spacing between the matrix and gene bar |
Labels and Axes
Option |
Default |
Meaning |
|---|---|---|
|
|
x-axis label |
|
|
y-axis label |
|
|
show sample labels |
|
|
sample label placement |
|
|
sample label rotation |
|
|
show x-axis label |
|
|
show y-axis label |
|
|
show TMB y-axis label |
|
|
show TMB tick labels |
|
|
show gene bar axis |
Legends
Option |
Default |
Meaning |
|---|---|---|
|
|
draw mutation legend |
|
|
draw legend titles |
|
|
|
|
|
draw categorical metadata legends and numeric metadata colorbars |
|
|
|
|
|
mutation legend key size multiplier |
|
|
per-legend |
|
|
optional metadata legend row limit |
|
|
optional metadata legend column count |
|
|
metadata legend key size multiplier |
|
|
optional maximum displayed legend label length |
|
|
optional maximum displayed legend title length |
Plotly uses one shared interactive legend. mutation_legend_position="none"
hides mutation traces while categorical metadata legends can remain visible. A
bottom request creates a horizontal Plotly legend; otherwise visible legends are
placed vertically on the right. Expanded main-grid variant-value colorbars are
an exception: Plotly and Matplotlib place them horizontally below the plot area so
they do not compete with right-side metadata legends. Matplotlib keeps separate
static legend layout controls, including metadata_legend_nrow and
metadata_legend_ncol.
legend_offsets targets individual legends by stable keys. Use source columns
where available, such as mutation:type, tmb:tmb_type, metadata:clinical_group,
or variant:vaf. Use stable fallback keys for legends without one source column:
mutation, tmb, variant:shared, and gene_bar. Positive x moves right and
positive y moves up. Plotly splits only targeted categorical legend groups into
separate legend containers; untargeted legends keep the default shared position.
Tile Styling
Option |
Default |
Meaning |
|---|---|---|
|
|
empty tile background |
|
|
mutated and empty tile height |
|
|
mutated and empty tile width |
|
|
tile border width |
|
|
row separator width |
|
|
fallback mutation color |
|
|
multi-hit color |
tile_width and tile_height are Matplotlib/static-layout controls. Plotly
uses fixed interactive square markers; tile_linewidth applies to marker
outlines in both renderers.
Fonts
Option |
Default |
Meaning |
|---|---|---|
|
|
x-axis label size |
|
|
y-axis label size |
|
|
gene label size |
|
|
sample label size |
|
|
metadata row label size |
|
|
numeric metadata min/max label size |
|
|
TMB axis text size |
|
|
gene bar text size |
|
|
explicit mutation/TMB/Plotly legend label size |
|
|
explicit mutation/TMB/colorbar legend title size |
|
|
explicit metadata legend label size |
|
|
explicit metadata legend title size |
|
|
top-level figure title size |
|
|
named subplot title size |
|
|
explicit pathway strip label size |
|
|
extra leftward padding for expanded-grid gene labels |
|
|
extra leftward padding for expanded-grid row labels |
|
|
renderer font family |
|
|
gene label style |
|
|
sample label style |
|
|
metadata row label style |
Plotly applies practical font sizes for sample ticks, gene ticks, axis labels,
TMB axes, gene-bar axes, and metadata row labels. Font face style controls such
as gene_font_style, sample_font_style, and font_style_metadata are
Matplotlib/static-layout oriented.
Titles
Option |
Default |
Meaning |
|---|---|---|
|
|
optional top-level figure title |
|
|
optional main mutation matrix title |
|
|
optional TMB subplot title |
|
|
optional gene-bar subplot title |
|
|
optional metadata subplot title |
TMB and Gene Bar
Option |
Default |
Meaning |
|---|---|---|
|
|
log-transform TMB values |
|
|
use scientific TMB labels where supported |
|
|
|
|
|
show recurrence percentage labels |
|
|
rounding for recurrence labels |
|
|
extra x-axis room for gene-bar percentage labels |
|
|
additional x-axis nudge for gene-bar labels |
|
|
explicit gene-bar axis tick positions |
|
|
requested number of gene-bar axis breaks |
In Plotly, gene_bar_scale_n_breaks is passed through as an nticks request
when gene_bar_scale_breaks is not supplied.
gene_bar_mode="percent" keeps the same mutation-type colors but normalizes
each gene’s stacked bar to 100%.
Pathways
Option |
Default |
Meaning |
|---|---|---|
|
|
pathway strip label color |
|
|
pathway strip fill color |
|
|
pathway strip border color |
|
|
pathway strip label rotation |
Metadata
Option |
Default |
Meaning |
|---|---|---|
|
|
legend label for missing metadata |
|
|
visible NA marker text size |
|
|
maximum categorical levels allowed per metadata track |
|
|
|
|
|
orientation hint for numeric heatmap legends |
|
color sequence |
fallback metadata colors |
Categorical metadata tracks reuse metadata_default_colors from the beginning
when there are more levels than fallback colors. metadata_numeric_plot_type="bar"
and metadata legend row/column controls are Matplotlib/static metadata controls.
metadata_legend_orientation_heatmap controls numeric metadata colorbar
orientation in both backends.
Plotly renders compact metadata heatmaps and categorical metadata legend entries
that fit its interactive model.
Text Prettification
Option |
Default |
Meaning |
|---|---|---|
|
|
prettify legend titles |
|
|
prettify legend values |
|
|
function used for display labels |
Common Bundles
Compact static plot:
OncoplotOptions(
width=900,
height=520,
font_size_genes=8,
tile_linewidth=0.1,
row_separator_linewidth=0.2,
)
Gallery-style static plot:
OncoplotOptions(
width=1800,
height=900,
log10_transform_tmb=False,
show_gene_bar_labels=True,
mutation_legend_position="right",
metadata_legend_position="right",
metadata_numeric_plot_type="bar",
)