【发布时间】:2021-07-23 07:39:43
【问题描述】:
当我将自己的文本添加到 ggplotly 的工具提示中时,文本的顺序会发生变化。在我的示例中,我的文本中的顺序是葡萄牙语,然后是德语,但是在情节上,顺序是不同的。
我该如何解决这个问题?
谢谢
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"))
【问题讨论】: