plotly / plotly/plotly.py

px.timeline Incorrectly interprets x_end datetimes

オープン
#3,473 コメント 5 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
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.
px_timeline_error

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).

correct_scatter

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. 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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。