[FEATURE]: Flexible tick label positioning on categorical axes (anchoring + between-category placement)
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 18.3k
- フォーク
- 2k
- 平均マージ
- 2日 12時間
- マージ済み PR(30日)
- 28
説明
Description
Add support for more flexible positioning of tick labels on categorical axes, to correctly handle grouped or hierarchical categories—especially when groups contain an even number of items.
Specifically, this request proposes:
- Configurable horizontal text anchoring for tick labels (left, center, right), and
- Optional placement of tick labels at fractional (non‑data) axis positions, i.e. between two categorical ticks.
Currently, tick labels are always centre‑anchored on discrete tick positions, which prevents accurate or visually correct centring for even‑sized groups.
Why should this feature be added?
This is a recurring UX limitation in real‑world charts that use:
- grouped or hierarchical categorical axes,
- experimental or test‑matrix layouts,
- manufacturing and operational visualisations.
For even‑sized groups, the true visual centre lies between two categories, but:
- tick labels cannot be placed between ticks,
- text anchoring cannot be adjusted,
- whitespace or HTML hacks are neutralised by automatic centring,
- annotations are not a clean substitute for tick labels.
Providing:
- anchor control (left / centre / right) would address many alignment issues with minimal complexity, while
- fractional tick‑label positioning would solve the problem exactly for grouped categories.
Together, these features would significantly improve readability, reduce workarounds, and enable precise hierarchical labelling without breaking Plotly’s axis model.
Mocks / Designs
Conceptually:
- a grouped label whose left edge aligns with a group boundary (e.g. at x = 1.5),
- or a label centred between two categorical ticks rather than on a data point.
A simple screenshot of a grouped categorical axis with an even number of categories clearly illustrates the current limitation.
Notes
- Applicable to plotly.js and all language bindings (Python, R, etc.).
- Most visible when compressing or centring hierarchical tick labels.
- Proposed as:
- Primary feature: tick‑label horizontal anchoring
- Advanced extension: fractional / between‑category tick placement
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue ではファイル、テスト、エントリーポイントが指定されていないため、まず plotly.js 内でカテゴリ軸の目盛りラベルの描画箇所と既存のテストを見つけます。水平方向のアンカーと小数による配置の間でスコープを定義し、グループ化されたカテゴリラベルを左、中央、右に揃えられること、およびカテゴリ間の位置が正しく動作することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- data-visualization
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100