geom_feature_label() adds text labels to features drawn with
As standard for ggplot2. inherit.aes is set to FALSE by default, as features are not likely to share any plot aesthetics other than y.
grid::unit() object giving the height of the feature
being labelled, and hence the distance of the label above or below the
molecule line. Can be set as a negative value for features drawn below the
line. Defaults to 4 mm, to align labels with the default height of
grid::unit() object giving the height of the label
text. Defaults to 3 mm.
Standard 'ggplot2' aesthetics for text are supported (see Aesthetics).
x (required; position of the feature)
y (required; molecule)
label (required; the label text)
forward (optional; will draw text in the appropriate location for features with angled arrowheads)
ggplot2::ggplot(example_genes, ggplot2::aes(xmin = start, xmax = end, y = molecule, fill = gene)) + geom_gene_arrow() + geom_feature(data = example_features, ggplot2::aes(x = position, y = molecule, forward = forward)) + geom_feature_label(data = example_features, ggplot2::aes(x = position, y = molecule, label = name, forward = forward)) + ggplot2::facet_wrap(~ molecule, scales = "free")