-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
The sample code below plots a Figure with some Scattergl traces, rendered inside a dcc.Graph component.
Each trace has mode “lines+text”.
With Plotly 5 this used to work as expected; after updating to Plotly >= 6.0.0, the graph component still loads, but no data points are visible.
No errors are shown in the browser console or Python logs (as a note, Dash 3 was used).
Sample Code
import dash
from dash import dcc, html
import plotly.graph_objs as go
import numpy as np
# Generate data for many scattergl traces
num_points = 10000
num_traces = 4
traces = []
for i in range(num_traces):
x = np.arange(num_points)
y = np.random.rand(num_points) + i
customdata = [f"Trace {i+1} - Point {j}" for j in range(num_points)]
labels = [f"Trace {i+1} - Point {j}" if j==0 else "" for j in range(num_points)]
trace = go.Scattergl(
x=x,
y=y,
mode='lines+text',
name=f'Trace {i+1}',
customdata=customdata,
text=labels,
textposition='top center',
hovertemplate="%{customdata}<br>X: %{x}<br>Y: %{y}<extra></extra>"
)
traces.append(trace)
# Create the figure
fig = go.Figure(data=traces)
fig.update_layout(title=f'ScatterGL with {num_traces} Traces', xaxis_title='X', yaxis_title='Y')
# Create Dash app
app = dash.Dash(__name__)
app.layout = html.Div([
html.H1("Dash ScatterGL Example"),
dcc.Graph(figure=fig)
])
if __name__ == "__main__":
app.run(debug=True)
Turning Scattergl mode from “lines+text” into “lines” restores the expected behaviour.
Playing with the number of traces or data points seems to have no effect.
Environment
The issue occurs with the following environment:
Python version: 3.9.7
Dash version: 3.2.0
Plotly version: 6.3.0
Browser: Chrome 139
OS: Windows 11
As already mentioned, downgrading Plotly (e.g. from version 6.3.0 to 5.24.1) restores the expected behaviour.