# 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)
# }
Run the code above in your browser using DataCamp Workspace