简体   繁体   English

避免在R中的条形图中出现图例

[英]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 - 尝试像这样添加hoverinfo = 'x+y'

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))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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