plotly / plotly/plotly.js

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

Abierto
#7,794 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

feature
Lenguaje dominante
JavaScript
Estrellas
18.3k
Forks
2k
Merge medio
2 d 12 h
PR fusionados (30 d)
28

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

El issue no menciona archivos, tests ni puntos de entrada; empieza localizando la renderización de las etiquetas de los ticks del eje categórico y sus tests existentes en plotly.js. Define el alcance entre el anclaje horizontal y el posicionamiento fraccionario, y verifica que las etiquetas categóricas agrupadas puedan alinearse a la izquierda, al centro o a la derecha, y que las posiciones entre categorías se comporten correctamente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
data-visualization
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.