Annotations: Dynamic
- Added with
text = "...."
- Without coordinates
hoverinfo = "text"
- Turn off hoverinfo:
hoverinfo = "none"
swiss$Catholic.cat <- cut(swiss$Catholic,
breaks = c(-Inf, 30, 60, Inf),
c("% Catholic: Low","% Catholic: Middle","% Catholic: High"))
names <- rownames(swiss)
p <- plot_ly(data = swiss,
x = ~Education,
y = ~Fertility,
color = ~Catholic.cat,
colors = c("black", "yellow", "red"),
size = ~Catholic, mode = "markers",
text = ~paste(names, ": ", swiss$Catholic, " %", sep=""),
hoverinfo = "text")
p