Scattergl not drawing line with np.inf but only when in pd.Dataframe
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 18.8k
- Forks
- 2.8k
- Merge medio
- 16 h 26 min
- PR fusionados (30 d)
- 21
Descripción
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()
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza ejecutando la reproducción de Python proporcionada con plotly 6.0.0 y compara las entradas de Scatter, Scattergl y las convertidas a listas. El issue estará terminado cuando Scattergl renderice de forma consistente con los otros ejemplos la línea de Pandas Series que contienen np.inf.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- pandas, python
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 45/100