geom_feat() allows the user to draw (additional) features to the plot/graph. For example, specific regions within a sequence (e.g. transposons, introns, mutation hotspots) can be highlighted by color, size, etc..

  mapping = NULL,
  data = feats(),
  stat = "identity",
  position = "pile",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,



Set of aesthetic mappings created by aes(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.


feat_layout: Uses first data frame stored in the feats track by default.


The statistical transformation to use on the data for this layer, either as a ggproto Geom subclass or as a string naming the stat stripped of the stat_ prefix (e.g. "count" rather than "stat_count")


describes how the position of different plotted features are adjusted. By default it uses "pile", but different ggplot2 position adjustments, such as "identity or "jitter" can be used as well.


If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.


logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display.


If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders().


Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3. They may also be parameters to the paired geom/stat.


geom_feat uses ggplot2::geom_segment under the hood. As a result, different aesthetics such as alpha, linewidth, color, etc. can be called upon to modify the visualization of the data.

By default, the function uses the first feature track.


# Plotting data from the feats' track with adjusted linewidth and color
gggenomes(seqs = emale_seqs, feats = emale_ngaros) +
geom_seq() +
geom_feat(linewidth = 5, color = "darkred") 

# Geom_feat can be called several times as well, when specified what data should be used
gggenomes(seqs = emale_seqs, feats = list(emale_ngaros, emale_tirs)) +
geom_seq() +
geom_feat(linewidth = 5, color = "darkred") + #uses first feature track
geom_feat(data = feats(emale_tirs))

# Additional notes to feats can be added with functions such as: geom_feat_note / geom_feat_text
gggenomes(seqs = emale_seqs, feats = list(emale_ngaros, emale_tirs)) +
geom_seq() +
geom_feat(color = "darkred") +
geom_feat(data=feats(emale_tirs), color = "darkblue") +
geom_feat_note(data = feats(emale_ngaros), label="repeat region", size = 4) 

# Different position adjustments with a simple dataset 
exampledata <- tibble::tibble(
seq_id = c(rep("A", 3), rep("B", 3), rep("C", 3)),
start = c(0, 30, 15, 40, 80, 20, 30, 50, 70),
end = c(30, 90, 60, 60, 100, 80, 60, 90, 120))

gggenomes(feats = exampledata) +
geom_feat(position = "identity", alpha = 0.5, linewidth = 0.5) +
#> No seqs provided, inferring seqs from feats