繁体   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