plotly / plotly/plotly.py

Bar yaxis range does not work with datetime

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

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

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

説明

Hello, I would like to use range with go.Bar and datetime.
From the docs https://plotly.com/python/reference/layout/yaxis/#layout-yaxis-range
I should provide range with start and end in str.

range=[str(datetime.time(hour=0)), str(datetime.time(hour=10))],

But what I get is this:

Screenshot 2021-12-06 at 11 38 26

The code:

    import plotly.graph_objects as go
    import datetime

    figure = go.Figure()
    figure.add_trace(
        go.Bar(
            x=x,
            y=y,
            legendgroup="duration",
            legendgrouptitle_text="Sleep",
            name="Sleep",
        )
    )
    
        figure.update_layout(
        xaxis=dict(
            title="Date",
            type="category",
        ),
        yaxis=dict(
            title="Time (hours)",
            type="date",
            tickformat="%H:%M",
            range=[0, str(datetime.time(hour=10))],
        ),
    )
    

The data:

>>> print(x)
['Nov 30 2021']

>>> print(y)
0   2021-12-06
Name: duration, dtype: datetime64[ns]

y is a pandas DataFrame

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

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

はじめの一歩

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

調査の方向性

提供された Python の再現コードを go.Bar と figure.update_layout を使って開始し、次に yaxis type、tickformat、range の値を、参照されている yaxis の範囲に関するドキュメントと比較します。datetime の y 軸が要求された境界値を受け入れ、意図した 00:00–10:00 の範囲内にバーを表示すれば完了です。

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

評価

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

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

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