plotly / plotly/plotly.py

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

Open
#5,550 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the current quartilemethod documentation and the existing Box and Violin plot behavior, then compare the reported Method #10 results with Pandas and NumPy's default Method #7. Identify the appropriate new quartilemethod option and verify that Box and Violin hover values align with the external calculations.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, pandas, python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.