LabelPoints: Add text labels to a ggplot2 plot

Description Usage Arguments Value See Also Examples

View source: R/visualization.R

Description

Add text labels to a ggplot2 plot

Usage

1
2
3
4
5
6
7
8
9
LabelPoints(
  plot,
  points,
  labels = NULL,
  repel = FALSE,
  xnudge = 0.3,
  ynudge = 0.05,
  ...
)

Arguments

plot

A ggplot2 plot with a GeomPoint layer

points

A vector of points to label; if NULL, will use all points in the plot

labels

A vector of labels for the points; if NULL, will use rownames of the data provided to the plot at the points selected

repel

Use geom_text_repel to create a nicely-repelled labels; this is slow when a lot of points are being plotted. If using repel, set xnudge and ynudge to 0

xnudge, ynudge

Amount to nudge X and Y coordinates of labels by

...

Extra parameters passed to geom_text

Value

A ggplot object

See Also

geom_text

Examples

1
2
3
4
5
data("pbmc_small")
ff <- TopFeatures(object = pbmc_small[['pca']])
cc <- TopCells(object = pbmc_small[['pca']])
plot <- FeatureScatter(object = pbmc_small, feature1 = ff[1], feature2 = ff[2])
LabelPoints(plot = plot, points = cc)

ibseq/scs-analysis documentation built on Feb. 27, 2021, 12:35 a.m.