r - 绘制 X 轴间隔
解决方案
这里的问题不是 x 轴本身,而是垃圾箱的数量。您可以使用以下方式进行调整nbinsx
:
plot_ly(x, type = "histogram", nbinsx = 20)
注释后带有一些示例数据的示例:
代码 1:
library(plotly)
set.seed(1)
numbers <- rnorm(100,20, 20)
p1 <- plot_ly(x = ~numbers,type = "histogram")
p1
情节1:
代码 2:
p2 <- plot_ly(x = ~numbers,type = "histogram", nbinsx=20)
p2
情节2:
代码 2:
p3 <- plot_ly(x = ~numbers,type = "histogram", nbinsx=20)
p3
情节3:
代码 3:
p3 <- plot_ly(x = ~numbers,type = "histogram", nbinsx=5)
p3
推荐阅读
- xml - 如果元素不存在,则雪花 XML 解析
- xml - 如何在 Symfony 中动态创建实体类
- python - jupyter notebook 之间的自定义消息
- android - API 19:网络安全策略不允许明文通信
- python - 在 Python 中绘制连接点的 xy 网格
- amazon-sagemaker - 如何在 AWS SageMaker 中为超参数调整作业设置种子以实现重现性
- python - 为什么我不能使用 Visual Studio Code 为这个 Django 项目启用 Pylint?
- python - 使用多个分隔符拆分多个列;新形成的列应该有原始值的计数
- android - 如何在 Android 10 中的屏幕锁定屏幕时启动活动
- amazon-web-services - 我很困惑如何使用 Amazon Cognito 用户池控制 API Gateway Rest API 中的访问