I create a basic scatterplot with plotly like the one below. The issue is that while I set specifically the text inside the hoverinfo the numeric values are displayed one more time- (20,56)
-before the actual text- Team Pts:20 Fantasy Pts: 56
-that I wish to display. How can I delete them?
pts<-c(10,20,30)
npts<-c(24,56,78)
ex<-data.frame(pts,npts)
library(plotly)
p <- plot_ly(data = ex, x = ~pts, y = ~npts,
marker = list(size = 10,
color = 'white',
line = list(color = 'rgba(152, 0, 0, .8)',
width = 2))) %>%
add_trace(
text = ~paste("Team Pts: ", pts, '</br>Fantasy Pts:', npts),
hoverInfo='text'
)
p