Ticklabels can not be middle aligned when using a weekly period
オープン
まだ誰も着手していません。
bug
P3
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
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.
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、報告にある最小限の Python 例を実行し、日次、月次、週次の期間のケースを比較します。週次期間における期間モードの tick-label の配置動作を追跡し、関連する Plotly の実装と回帰テストの場所を特定します。完了の条件は、他の期間のケースが正しいまま、週次ラベルがピクセルベースのシフトなしにレスポンシブに中央揃えされることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100