Skip to content

Scattergl not drawing line with np.inf but only when in pd.Dataframe #5228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ktamm0 opened this issue Jun 12, 2025 · 0 comments
Open

Scattergl not drawing line with np.inf but only when in pd.Dataframe #5228

ktamm0 opened this issue Jun 12, 2025 · 0 comments
Labels
bug something broken P2 considered for next cycle

Comments

@ktamm0
Copy link

ktamm0 commented Jun 12, 2025

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()
@gvwilson gvwilson added bug something broken P2 considered for next cycle labels Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P2 considered for next cycle
Projects
None yet
Development

No branches or pull requests

2 participants