plotly / plotly/plotly.py

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

オープン
#5,550 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、現在の quartilemethod のドキュメントと既存の Box および Violin プロットの動作を読み、報告されている Method #10 の結果を Pandas と NumPy のデフォルトの Method #7 と比較します。適切な新しい quartilemethod オプションを特定し、Box と Violin のホバー値が外部計算と一致することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
numpy, pandas, python
領域
data-visualization
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。