Align the use of `y=` argument with `error_y` in `plotly.express`
オープン
まだ誰も着手していません。
feature
P3
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
At the moment, I can plot multiple y series with an API that looks like this:
import pandas as pd
import plotly.express as px
data = {
'X_Values': pd.date_range(start='2023-01-01', periods=10, freq='D'),
'Y1_Values': [3, 5, 7, 9, 11, 13, 15, 17, 19, 21],
'Y2_Values': [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],
'Y3_Values': [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],
}
df = pd.DataFrame(data)
px.scatter(df, x='X_Values', y=['Y1_Values', 'Y2_Values', 'Y3_Values'])
I would expect to be able to provide an array of error bars for each of the y's but that doesn't seem to be the case:
import pandas as pd
import plotly.express as px
data = {
'X_Values': pd.date_range(start='2023-01-01', periods=10, freq='D'),
'Y1_Values': [3, 5, 7, 9, 11, 13, 15, 17, 19, 21],
'Y1_Errors': [0.5, 0.6, 0.7, 0.5, 0.8, 0.5, 0.7, 0.6, 0.5, 0.7],
'Y2_Values': [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],
'Y2_Errors': [0.3, 0.5, 0.4, 0.6, 0.7, 0.5, 0.6, 0.4, 0.5, 0.6],
'Y3_Values': [1, 3, 5, 7, 9, 11, 13, 15, 17, 19],
'Y3_Errors': [0.4, 0.3, 0.6, 0.5, 0.7, 0.4, 0.5, 0.3, 0.6, 0.5],
}
df = pd.DataFrame(data)
px.scatter(df, x='X_Values', y=['Y1_Values', 'Y2_Values', 'Y3_Values'], error_y=['Y1_Errors', 'Y2_Errors', 'Y3_Errors'])
but this fails with
ValueError: All arguments should have the same length. The length of argument `error_y` is 3, whereas the length of previously-processed arguments ['X_Values'] is 10
Can this get similar semantics to an array-like object in the y= argument?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
plotly.express.scatter を使用して例を再現し、まず y 引数と error_y 引数の処理から始めます。array-like な y の値がどのように展開されるかを、error_y がどのように検証されるかと比較します。各 y 系列に対応するエラー配列を、報告されている長さエラーなしで指定でき、関連する動作がテストでカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- data-visualization
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100