Complete canonical API text; task articles explain the workflows. Tutorials
Site guide · find your task
Setup and learning paths
HomeInstall and prepare the environmentChoose your learning moduleModule I · Chord
1.1 Tables and field meanings1.2 Produce and import comparisons1.3 Build the layers step by step1.4 Direction, curvature and clearance1.5 Filter and summarize links1.6 Full source-file workflow1.7 Complete chord showcaseModule II · Collinear
2.1 Reuse chord input tables2.2 Switch coordinates and add layers2.3 Routes, clearance and the ruler2.4 Compare CDS neighbourhoods2.5 Focus, anchors and segments2.6 Complete collinear showcaseModule III · Plasmid
3.1 DNA, annotations and 13 references3.2 From a circle to annotation layers3.3 Features, primers and restriction3.4 Thirteen plasmid references3.5 Complete plasmid casesConsult as needed · Data and layers
Prepare tables and coordinatesImport and convert dataImport nucleotide and protein alignmentsProject protein intervals to genomic coordinatesFeatures, stacking and genomic decorationLabels and local placementQuantitative tracksMappings, scales, guides and themesSet values by sequence and strandCommon adjustments and grammarExport, preview and diagnosticsLearning map and reference
Articles and complete workflowsFunction referenceReproducible galleryFrequently asked questionsMigrate to the candidate APITerminology and design sourcesDevelopment status and changesAdds a free-standing reference bar in the empty space outside the sequence
envelope. Its length uses the same bp-to-x conversion as every backbone in
coord_collinear(), including independent windows on shared display rows.
Display gaps are never interpreted as genomic length. Local reversals and
original-source axis labels do not change the bar's bp scale. Chord and
circular coordinates have local sequence axes instead and are rejected.
Usage
Code
geom_seq_scale(
mapping = NULL,
data = NULL,
length = NULL,
label = NULL,
location = c("bottomleft", "bottomright", "topleft", "topright"),
offset = grid::unit(c(2, 6), "mm"),
tick_height = grid::unit(1.5, "mm"),
label_gap = grid::unit(1.5, "mm"),
linewidth = 0.4,
colour = "#3D4348",
size = 3,
position = "identity",
show.legend = FALSE,
inherit.aes = FALSE,
...
)Arguments
- mapping, data
Standard ggplot2 layer inputs. Optional
scale_lengthmaps one positive integer bp length per bar;labelsupplies its text. Multiple bars require explicitxandylayout positions indata(or their role mappings), to avoid accidental overprinting.- length
Optional fixed positive integer length in bp. Cannot be combined with a
scale_lengthmapping.NULLuses input lengths or an automatic reference length.- label
Optional fixed character label, or a function receiving the chosen bp lengths.
NULLuses input labels or formatted"... bp"text.- location
Corner of the sequence envelope used for automatic placement.
- offset
Two non-negative distances, horizontal then vertical. Absolute grid units are supported; plain numeric values are layout-unit distances.
- tick_height, label_gap
Non-negative absolute grid units or layout-unit numbers for the end ticks and space between the bar and caption. Physical conversion uses the current render context when available; device-free builds retain an explicitly estimated measurement status.
- linewidth, colour, size
Fixed line colour/width and text size. Text size follows ordinary ggplot2 millimetres. These may also use normal mappings and scales when not supplied as fixed arguments.
- position, show.legend, inherit.aes
Standard ggplot2 layer arguments.
- ...
Additional fixed aesthetics passed to
ggplot2::layer().
Value
One independent ggplot2 layer. Exported axis geometry retains the bp length, input row and measurement status for each bar.
Details
The bar does not claim to span one source interval. An explicit length can therefore exceed a single window and still be a valid distance reference in the shared linear metric. With no length, a small whole-number 1/2/5 reference is chosen from displayed window lengths. No source coordinates are modified and no missing genomic region is manufactured.
To change ticks and labels on sequence axes instead, use
scale_seq_position_continuous(). A position scale configures existing
axes; this geom adds an independent distance reference.
