plotly / plotly/plotly.py

Consider showing UTC offset in tooltip for datetimes

未關閉
#4,844 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

feature P2
主要語言
Python
星號
18.8k
分支
2.8k
平均合併
16 小時 26 分鐘
30 天內合併 PR
21

描述

Say I have

import pandas as pd
dfa = pd.DataFrame(
    {
        "datetime": ["2020-10-25T01:30"] * 2,
        "price": [40, 50],
    }
)
dfa['datetime'] = pd.to_datetime(dfa['datetime']).dt.tz_localize('Europe/London', ambiguous=[True, False])
dfa
                   datetime  price
0 2020-10-25 01:30:00+01:00     40
1 2020-10-25 01:30:00+00:00     50

and I plot

px.scatter(dfa, x="datetime", y="price")

then I get

Image

Notice how the two points are stacked one on top of each other, even though they are actually 1 hour apart

If Plotly's design decision for time zones is to display the local datetime, then I think this makes perfect sense, nice one 👍 However, I think the tooltip should give enough information to distinguish the two points, whereas currently, they both show:

datetime=Oct 25, 2020, 01:30

I would expect the bottom one to show datetime=Oct 25, 2020, 01:30 +01:00 and the top one to show datetime=Oct 25, 2020, 01:30 +00:00

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先執行 issue 中的 Python 重現程式,並檢查 Plotly 如何在 hover tooltip 中格式化 datetime 值。完成的標準是:透過顯示 UTC offset,兩個有歧義的 Europe/London datetime 仍能彼此區分,並為此範例加入 coverage。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
data-visualization
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。