簡體   English   中英

避免在R中的條形圖中出現圖例

[英]Avoiding a legend in plotly bar chart in r

在此帶說明的條形圖中,我想隱藏顯示在所附圖像中正方形中的文本。

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

嘗試像這樣添加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