plotly / plotly/plotly.js

[FEATURE]: Flexible tick label positioning on categorical axes (anchoring + between-category placement)

Ouverte
#7,794 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

feature
Langage dominant
JavaScript
Étoiles
18.3k
Forks
2k
Merge moyen
2 j 12 h
PR mergées (30 j)
28

Description

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.

Image

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

L’issue ne nomme aucun fichier, test ou point d’entrée ; commencez par localiser le rendu des étiquettes de graduations de l’axe catégoriel et ses tests existants dans plotly.js. Définissez le périmètre entre l’ancrage horizontal et le positionnement fractionnaire, puis vérifiez que les étiquettes catégorielles groupées peuvent être alignées à gauche, au centre ou à droite, et que les positions entre les catégories se comportent correctement.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
data-visualization
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
38/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.