When I add my own text into the tooltips for ggplotly the order of the text changes. In my example the order is Portuegese then German in my text, however on the plot the order is different.
How do I fix this?
Thanks
library(ggplot2);
library(plotly);
language <- c("de","es","hi","pt","sv","en")
averageRating <- c(6,4,3,9,10,30)
my_data <- data.frame(language, averageRating)
text <- c("Portuegese","German","Spanish","Hindi","Swedish","English")
p <- ggplot(data=my_data, aes(x=language, y=averageRating, text = text)) +
geom_bar(stat = "identity")
ggplotly(p, tooltip = c("text"))