簡體   English   中英

在R中Plotly:如何增加吧之間的空間?

[英]Plotly in R: how to increase the space between bars?

朋友們!

如果我在R中使用plotly繪制條形圖,默認情況下,條形之間沒有間距。

我的問題是:

  1. 如何增加酒吧之間的空間? (見圖)
  2. 如何避免文本和欄的重疊? (見圖)

非常感謝!

插圖

使用數字x軸時會發生這種情況...嘗試輸入as.factor(VARIABLE)

示例:計算包含您正在繪制的df =數據框的漸變類的行數; x =您正在繪制的變量

plot_ly(df,x = df $ x)

 -this gives you a messy looking blob

plot_ly(df,x = as.factor(df $ x))

 -now it is known that your x axis is a factor, it will separate each value and break it up with a space in between

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM