plotly / plotly/plotly.py

Bar chart with timeseries index not displaying depending on proximity of the times

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

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

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

Found an issue causing a bar chart to display nothing when displaying timeseries data. It seems to be caused by having stacked data at two points which are very close in time (e.g. 12:00:00 and 12:00:01) and then one point much further away (e.g. 17:00:00).

import pandas as pd
import plotly.express as px

times = ['2020-12-18 02:15:00', '2020-12-18 02:15:00', '2020-12-18 02:15:00', '2020-12-18 02:15:01']  
#times = ['2020-12-18 02:15:00', '2020-12-18 02:15:00', '2020-12-18 02:15:00', '2020-12-18 02:15:00'] <-- works
vals = [10, 50, 20, 350, 250]

# Uncomment to cause bar chart to display no data
# times.append('2020-12-18 13:00:00')
# vals.append(1)
  
df = pd.DataFrame(list(zip(times, vals)), 
               columns =['DT', 'Val']) 

df['DT'] = pd.to_datetime(df['DT'])

df = df.set_index('DT')
fig = px.bar(df, x=df.index, y=df['Val'])

fig.show()
  • The code unchanged displays the figure fine
    1
  • If you uncomment the two append lines, adding in a data point which is further away, then the figure is empty
    2
  • If you uncomment the two append lines and changes the initial times list so that they are all :00, the figure displays fine
    3

Therefore it seems to be caused by having points at 02:15:00 / 02:15:01 and then a point much later at 13:00:00

Thanks

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、issue の pandas と Plotly Express による再現手順を実行します。最初は近接したタイムスタンプを使い、次に 13:00:00 の点を追加して実行します。両方の場合について、生成された figure のデータまたはレンダリングを比較します。失敗するケースで棒グラフが指定された時系列データを表示し、動作している例を壊さなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
pandas, plotly, python
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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