Description Usage Arguments Details Value Author(s) Examples
Shiny gadget for selecting points to label in a ggplot object
1 2 |
gg |
ggplot object |
mapping |
aesthetics mapping, from |
data |
data.frame with data for plotting |
geom |
geom to use – "text" or "label" |
... |
additional arguments to pass to |
width |
width of plot, as percent or pixels |
height |
height of plot, as percent or pixels |
Click on a point or brush over a set of points to label them. Clicking on a labelled point or brushing over a set of points that are all labelled will remove the labels. Brushing over some points that are labelled and some that are not will add labels to the ones that are not.
gglabeller sses ggrepel for controlling the position of labels. The parameters tab can be used to adjust ggrepel parameters.
Upon clicking the "Done" button, the gadget returns a list with three elements:
The plot itself
The indices of the rows of the data used for labelling
a character vector with a code snippet for recreating the plot reproducibly
Alicia Schep
1 2 3 4 5 6 7 | if (interactive()){
p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point()
plabelled <- gglabeller(p, mapping = aes(label = rownames(mtcars)))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.