Align the use of `y=` argument with `error_y` in `plotly.express`
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
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?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduzieren Sie die Beispiele mit plotly.express.scatter, beginnend mit der Behandlung der Argumente y und error_y. Vergleichen Sie, wie array-artige y-Werte erweitert werden, damit, wie error_y validiert wird. Als erledigt gilt die Aufgabe, wenn passende Fehlerarrays für jede y-Serie bereitgestellt werden können, ohne den gemeldeten Längenfehler auszulösen, und das relevante Verhalten durch Tests abgedeckt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- data-visualization
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100