[FEATURE]: Flexible tick label positioning on categorical axes (anchoring + between-category placement)
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 18.3k
- Fork
- 2k
- Merge medio
- 2g 12h
- PR unite (30g)
- 28
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
La issue non indica file, test o punti di ingresso; inizia individuando il rendering delle etichette dei tick dell’asse categoriale e i relativi test esistenti in plotly.js. Definisci l’ambito tra l’ancoraggio orizzontale e il posizionamento frazionario, quindi verifica che le etichette categoriali raggruppate possano essere allineate a sinistra, al centro o a destra e che le posizioni tra le categorie si comportino correttamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- data-visualization
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100