px.timeline Incorrectly interprets x_end datetimes
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 18.8k
- 分支
- 2.8k
- 平均合併
- 16 小時 26 分鐘
- 30 天內合併 PR
- 21
描述
The px.timeline function incorrectly generates the end times of the bar traces. The end times are placed before the start times.
Python version 3.8.6
Plotly version 5.4
Steps to reproduce:
import datetime
import plotly.express as px
t0 = datetime.datetime.now()
tf = t0 + datetime.timedelta(hours=1)
px.timeline(x_start=[t0], x_end=[tf])
print(t0)
print(tf)
Produces
2021-11-16 12:21:14.800827 # t0
2021-11-16 13:21:14.800827 # tf
The resulting figure is below. Notice that the right edge of the bar is the same as the start time, but the left edge of the bar is something else entirely.

The behavior is the same when passing a dataframe and column names. If you generate a scatter plot using the same datetime objects, the output works as expected (shown below).

貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 px.timeline 入口點開始,使用報告中顯示的 datetime 值重現問題,並將其 bar trace 的座標與使用相同值的散點圖進行比較。追蹤 x_start 和 x_end 如何轉換到 figure 中,然後驗證產生的 bar 是否具有預期的開始和結束時間,以及 dataframe-and-column-names 情況是否也能正確運作。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- data-visualization
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100