简体   繁体   中英

Avoiding a legend in plotly bar chart in r

In this graph Bar chart with description I would like to hide the text that appearing into the square in the attached image.

p <- plot_ly(
     x = ~df1$x1,
     y = ~df1$y1,
     name = "Most frequent words",
     type = "bar",
     mode="markers" ,

color = ~df1$x1 ,
colors=c("red","blue") , showlegend = FALSE,

) %>%
layout(
    title = "Most frequent words for #Dante2018",
    yaxis = list(title = 'Frequency'),
    xaxis = list(title = 'Word', tickangle = -45))

Try adding hoverinfo = 'x+y' like so -

p <- plot_ly(
     x = ~df1$x1,
     y = ~df1$y1,
     name = "Most frequent words",
     type = "bar",
     mode="markers" ,

color = ~df1$x1 ,
colors=c("red","blue") , showlegend = FALSE,
hoverinfo = 'x+y'
) %>%
layout(
    title = "Most frequent words for #Dante2018",
    yaxis = list(title = 'Frequency'),
    xaxis = list(title = 'Word', tickangle = -45))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM