In the tooltip of the bar graph, it always displays text like this paste(hp, 'hp') 335 hp. What I want is just like this format: hp: 335 hp.
library(tidyverse)
library(plotly)
mtcars$cars = row.names(mtcars)
g = mtcars %>%
arrange(desc(hp)) %>%
head(., 10) %>%
ggplot(aes(x= reorder(cars, hp), y=hp,
text=cars, text1 = paste(hp, 'hp') ))+
geom_bar(stat='identity', fill='darkred')+
coord_flip()
ggplotly(g, tooltip = c("text","text1") )