plotly / plotly/plotly.py

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

Aperta
#5,228 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug P2
Lingua principale
Python
Stelle
18.8k
Fork
2.8k
Merge medio
16h 26m
PR unite (30g)
21

Descrizione

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()

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo la riproduzione Python fornita con plotly 6.0.0 e confronta gli input di Scatter, Scattergl e quelli convertiti in liste. L’issue è completata quando Scattergl esegue il rendering della linea proveniente da Pandas Series contenenti np.inf in modo coerente con gli altri esempi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
pandas, python
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.