Adding text shrinks bar chart area
未关闭
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
Adding text shrinks the bar chart area. Below we render a bar chart where the bars are on the x-axis. The add_text() call actually vertically shrinks the area of the plot, such that the distance from the bottom bar to the x-axis "0" is increased. If you run this output without the add_text() call, you'll see that the vertical width of the bar charts increases.
Adding text should not have an effect on the bar chart.
# Shrunken plot area
require(plotly)
#> Loading required package: plotly
#> Loading required package: ggplot2
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
cats = c(letters, paste0(letters,'2'), paste0(letters,'3'), paste0(letters,'4') )
data = data.frame(
y_axis_cat = rep(cats,8),
x_axis_num = rep(5,length(cats)*8),
cat = rep(paste0('Cat ',1:8), length(cats))
)
p = plotly::plot_ly(data) %>%
plotly::add_bars(
x = ~x_axis_num,
y = ~y_axis_cat,
color=~cat
) %>%
plotly::add_text(
x = 40,
y = ~y_axis_cat,
text = '40'
)
Created on 2023-04-10 with reprex v2.0.2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
运行提供的 R reprex,使用 plotly::plot_ly()、add_bars() 和 add_text(),然后将其与不使用 add_text() 的版本进行比较。追踪导致柱状图垂直区域缩小的图表布局行为;完成标准是添加文本后不再增大底部柱与 x 轴零点之间的距离。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100