add_labels | R Documentation |
Adds labels to a plotly 2d or 3d scatter plot. The labels can be dragged.
add_labels(p, labs, plotGlPixelRatio = 8)
p |
A plotly scatter plot object |
labs |
Character vector of labels to match |
plotGlPixelRatio |
Integer passed to plotly.js config which controls pixel resolution of webGl rendering. Larger values increase resolution of points as well as file size. |
Labels are identified by searching the rownames of the embedded marker data within the plotly object. The plotly mode bar camera icon is set to export to svg by default.
A plotly plot with added labels
library(plotly)
data(mtcars)
p <- plot_ly(mtcars, x = ~mpg, y = ~wt, color = ~cyl,
type = 'scatter', mode = 'markers')
p %>% add_labels(c("Mazda RX4", "Fiat 128"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.