plotly / plotly/plotly.py

[FEATURE]: Support for Method #7 (Pandas/NumPy default) in quartilemethod for Box and Violin plots

Abierto
#5,550 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

feature
Lenguaje dominante
Python
Estrellas
18.8k
Forks
2.8k
Merge medio
16 h 26 min
PR fusionados (30 d)
21

Descripción

Description

Currently, Plotly's go.Box and go.Violin calculate Q1 and Q3 using Method #10 (Langford) when quartilemethod is set to "linear". However, the industry standard for data analysis in Python (Pandas and NumPy's default method="linear") follows Method #7.

​This discrepancy creates a significant issue when users try to align Plotly's hover information with custom annotations or static tables calculated via Pandas. Even with the same "linear" naming, the resulting values (e.g., 4950.5 vs 4931.75) do not match, leading to confusion in professional reporting and automated screenshots.

I would like to request an additional option for the quartilemethod attribute (e.g., "standard" or "method7") that aligns with the default interpolation used in Pandas and NumPy (method="linear" / Type 7).

Why should this feature be added?

Consistency: Many users calculate summary statistics using Pandas before plotting. Having to manually inject q1, q3, and median as lists for every single trace just to match the hover data is highly inefficient.

Reproducibility: It is difficult to replicate Plotly’s internal Method #10 logic in external scripts without specific statistical knowledge, whereas Method #7 is the global default in the Python ecosystem.

User Experience: When creating dashboards that require fixed annotations alongside box plots, the numerical mismatch makes the visualization appear inaccurate to end-users.

Mocks/Designs

Please add any mocks or designs you might have for the feature.

Notes

Additional Context

According to the current documentation, Plotly uses Method #10 (from http://jse.amstat.org/v14n3/langford.html). Adding support for the more common Method #7 would greatly enhance the library's compatibility with the broader Python data science stack.

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

Comienza leyendo la documentación actual de quartilemethod y el comportamiento existente de los gráficos Box y Violin; después, compara los resultados reportados de Method #10 con el Method #7 predeterminado de Pandas y NumPy. Identifica la opción nueva adecuada de quartilemethod y verifica que los valores al pasar el cursor de Box y Violin coincidan con los cálculos externos.

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

Evaluación

Stack tecnológico
numpy, pandas, python
Área
data-visualization
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.