Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Ticklabels can not be middle aligned when using a weekly period

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

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

評価

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

調査の方向性

まず、報告にある最小限の Python 例を実行し、日次、月次、週次の期間のケースを比較します。週次期間における期間モードの tick-label の配置動作を追跡し、関連する Plotly の実装と回帰テストの場所を特定します。完了の条件は、他の期間のケースが正しいまま、週次ラベルがピクセルベースのシフトなしにレスポンシブに中央揃えされることです。

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

説明

bug P3

Plotly version: 6.2.0

Minimal Example
import plotly.graph_objects as go
import pandas as pd

data = [
    {"date": "2025-07-20", "total_sales": 23.34},
    {"date": "2025-07-27", "total_sales": 45.21},
    {"date": "2025-08-03", "total_sales": 12.98},
    {"date": "2025-08-10", "total_sales": 41.32},
]

df = pd.DataFrame.from_records(data)

def make_figure(df, period, step, title):
    fig = go.Figure()
    fig.add_trace(go.Bar(
        x=df['date'],
        y=df['total_sales'],
        xperiod=period,
        xperiod0=df['date'].min(),
        xperiodalignment="middle"
    ))
    fig.update_layout(
        xaxis={
            'ticklabelmode': 'period',
            'tickmode': 'linear',
            'dtick': period,
            'tick0': df['date'].min(),
            'ticklabelstep': step
        },
        title={
            'text': title
        })
    fig.show(renderer="browser")

MS_PER_DAY = 24 * 60 * 60 * 1000
make_figure(df, MS_PER_DAY, 7, "Period = 1 Day")
make_figure(df, MS_PER_DAY * 7, 1, "Period = 7 Days")

When plotting aggregated timeseries data in period mode, the ticklabels are aligned to the middle of the bar when the period is 1 day or even 1 month, but if I try to use a period of 1 week the ticklabels are aligned to the left side of the column.

Image Image

I cannot use ticklabelshift to move the labels towards the center since ticklabelshift requires the measurement in pixels and what I'm building is repsonsive, so the width of the chart in pixels is variable

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

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

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

はじめの一歩

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

plotly/plotly.py のほかの issue

plotly/plotly.py の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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