plotly / plotly/plotly.py

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

Ouverte
#5,550 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

feature
Langage dominant
Python
Étoiles
18.8k
Forks
2.8k
Merge moyen
16 h 26 min
PR mergées (30 j)
21

Description

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.

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

Commencez par lire la documentation actuelle de quartilemethod et le comportement existant des graphiques Box et Violin, puis comparez les résultats signalés de Method #10 avec la méthode par défaut Method #7 de Pandas et NumPy. Identifiez la nouvelle option appropriée de quartilemethod et vérifiez que les valeurs affichées au survol pour Box et Violin correspondent aux calculs externes.

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

Évaluation

Stack technique
numpy, pandas, python
Domaine
data-visualization
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

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