Scattergl not drawing line with np.inf but only when in pd.Dataframe
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
Hello,
I’m having a strange issue where a graph_objects Figure with Scatergl is not drawing anything if there is an np.inf in the series, but only if the data is coming from a Pandas Dataframe. The below code shows an example of the issue (See 3rd figure). This issue appears with 6.0.0 install in python.
import plotly.express as px
import plotly.graph_objects as go
import numpy as np
import pandas as pd
# Create a DataFrame with np.inf in a column
df = pd.DataFrame({
'x': [0, 1, 2, 3, 4],
'y': [0, 1, 4, 9, np.inf],
})
# Create a line plot (Things are OK)
fig = px.line(data_frame=df, x='x', y='y', title='Looks OK')
fig.show()
# Create a line plot w/ Scatter (Things are OK)
fig = go.Figure()
fig.add_trace(go.Scatter(
x=df['x'],
y=df['y'],
mode='lines',
))
fig.update_layout(title=dict(text="Looks OK"),)
fig.show()
# Create a line plot w/ Scattergl (Nothing shown on figure...)
fig = go.Figure()
fig.add_trace(go.Scattergl(
x=df['x'],
y=df['y'],
mode='lines',
))
fig.update_layout(title=dict(text="Nothing displayed..."),)
fig.show()
# Create a line plot w/ Scattergl (This is ok.... to_list fixes something?)
fig = go.Figure()
fig.add_trace(go.Scattergl(
x=df['x'].to_list(),
y=df['y'].to_list(),
mode='lines',
))
fig.update_layout(title=dict(text="Looks OK"),)
fig.show()
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
Beginne damit, die bereitgestellte Python-Reproduktion mit plotly 6.0.0 auszuführen, und vergleiche die Eingaben von Scatter, Scattergl und die in Listen konvertierten Eingaben. Das Issue ist abgeschlossen, wenn Scattergl die Linie aus Pandas Series, die np.inf enthalten, konsistent mit den anderen Beispielen rendert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- pandas, python
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100