Bar plot shows too many ticks
未关闭
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
In plotly 4.10.4 a bar plot with only one date observation shows actually multiple ticks when the ticks' format is converted. Here a minimal reproducible example:
library(dplyr)
library(plotly)
df <- tibble(Time = "2025-01", Animal = "Monkey", value = 2)
df %>%
plot_ly(x = ~Time, y= ~value, color = ~Animal) %>%
layout(
xaxis = list(
type = "date",
tickformat = "%b '%y"
)
)
This is not the case though for a stacked bar plot:
df <- tibble(Time = c("2025-01", "2025-01"), Animal = c("Monkey", "Lion"), value = c(2, 3))
df %>%
plot_ly(x = ~Time, y= ~value, color = ~Animal) %>%
layout(
barmode = "stacked",
xaxis = list(
type = "date",
tickformat = "%b '%y"
)
)
When looking at the dates without formatting one can see a few minimal shifts around the actual date:
df <- tibble(Time = "2025-01", Animal = "Monkey", value = 2)
df %>%
plot_ly(x = ~Time, y= ~value, color = ~Animal) %>%
layout(
xaxis = list(
type = "date"
)
)
Is this already somewhere addressed?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行使用 plot_ly() 以及 xaxis 类型和 tickformat 选项的单观测 R 示例,然后将其与堆叠柱状图和未格式化示例进行比较。跟踪日期轴和刻度格式的处理方式;完成的标准是,单日期柱状图显示预期的刻度,且不会引入额外的格式化刻度,同时现有的堆叠行为保持不变。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100