add_annotations
From plotly v4.5.2
by Carson Sievert
Add an annotation(s) to a plot
Add an annotation(s) to a plot
Usage
add_annotations(p, text = NULL, ..., data = NULL, inherit = TRUE)
Arguments
- p
a plotly object
- text
annotation text (required).
- ...
these arguments are documented at https://plot.ly/r/reference/#layout-annotations
- data
a data frame.
- inherit
inherit attributes from
plot_ly()
?
Examples
library(plotly)
# NOT RUN {
# single annotation
plot_ly(mtcars, x = ~wt, y = ~mpg) %>%
slice(which.max(mpg)) %>%
add_annotations(text = "Good mileage")
# multiple annotations
plot_ly(mtcars, x = ~wt, y = ~mpg) %>%
filter(gear == 5) %>%
add_annotations("five cylinder", ax = 40)
# }
Community examples
Looks like there are no examples yet.