Wrong width of bar in bar plots
未关闭
还没有人认领这个 Issue。
bug
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
I would have expected a single bar with a width of 0.05 here:
library(plotly)
plot_ly(
type = 'bar',
x = 0.2,
y = 10,
width = 0.05
) %>%
layout(
xaxis=list(range=c(0,1))
)
Instead, I get a single bar with width 0.6 (and not 0.05).
Similarily, I would have expected two bars, each of width 0.05 here:
plot_ly(
type = 'bar',
x = c(0.2, 0.5),
y = c(10, 8),
width = 0.05
) %>%
layout(
xaxis=list(range=c(0,1))
)
Instead, it shows two bars, but not of width 0.05.
Only if I'm plotting 4 bars (or more) do I get the correct width (of 0.05) for each:
plot_ly(
type = 'bar',
x = c(0.2, 0.5, 0.6, 0.7),
y = c(10, 8, 7, 3),
width = 0.05
) %>%
layout(
xaxis=list(range=c(0,1))
)
Checking with a Javascript codepen, using
var trace0 = {
type: 'bar',
x: [0.2],
y: [10],
width: 0.05
}
var layout = {
xaxis: {range: [0, 1]}
}
var data = [trace0]
Plotly.newPlot('myDiv', data, layout);
does give the expected result.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先使用 plot_ly() 和 layout() 重现三个 R 示例,然后将它们的条形宽度与 JavaScript CodePen 示例进行比较。追踪 R 输入如何转换为条形图入口点;当单条和双条图像像四条图像和 JavaScript 示例一样遵循 width = 0.05 时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 48/100