| labelPoints | R Documentation |
This function labels points in a ggplot object.
labelPoints(
p,
labelDF,
pointLabs = rownames(labelDF),
labelType = c("free", "boxed"),
labelSize = 2.5,
labelColor = "black",
labelRepulsion = 1,
labelPull = 1,
maxOverlaps = 50,
boxPadding = 0.2,
labelPadding = 0.1,
labelSegWidth = 0.4,
...
)
p |
A ggplot object. |
labelDF |
Label data frame. |
pointLabs |
Labels of points. |
labelType |
Whether to draw a box around labels (option 'boxed') or not (option 'free'). Default is 'free'. |
labelSize |
Label size. |
labelColor |
Label color. |
labelRepulsion |
Repulsion strength between labels. |
labelPull |
Attraction strength between a text label and its data point. |
maxOverlaps |
Maximum number of allowed overlaps. |
boxPadding |
Amount of padding around box. |
labelPadding |
Amount of padding around label. |
labelSegWidth |
Thickness of segment connecting label to point. |
... |
Additional arguments passed to |
A ggplot object.
filePath <- system.file('extdata', 'hullPlot.qs2', package='henna')
sharedDF <- qs2::qs_read(filePath)
name1 <- 'alpha'
name2 <- 'delta'
legendLabs <- as.factor(c('Non-top',
'Shared',
paste0('Top only for ', name2),
paste0('Top only for ', name1)))
p <- hullPlot(sharedDF, 'Shared markers plot', xInt=1.5, yInt=1.3,
xLab=paste0('avg_log2FC (', name1, ')'),
yLab=paste0('avg_log2FC (', name2, ')'),
legendLabs=legendLabs)
labelDF <- sharedDF[sharedDF[, 'avg_log2FC_1'] > 1.5 &
sharedDF[, 'avg_log2FC_2'] > 1.3, ]
p <- labelPoints(p, labelDF, labelType='boxed', nudge_x=0.1, nudge_y=0.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.