Large datasets
Interactive visualization of many points where SVG rendering becomes slow.
Plotly · Class
go.Scattergl creates WebGL-rendered scatter traces for interactive point or line charts. It is useful for larger datasets where faster rendering and interaction matter.
Scattergl is the WebGL-backed counterpart to Scatter for interactive point or line plots. Create it with x/y data and configure its rendering through trace attributes such as mode, while placing it inside a Figure for display.
go.Scattergl(arg=None, alignmentgroup=None, ...)A Scattergl trace object.
import plotly.graph_objects as go
fig = go.Figure(go.Scattergl(
x=[1, 2, 3, 4],
y=[2, 5, 3, 6],
mode="lines+markers",
name="series"
))
fig.show()Creates a WebGL-rendered scatter trace with both a connected line and point markers.
Interactive visualization of many points where SVG rendering becomes slow.
Connected time-series or measurement data requiring responsive pan and zoom.
Exploratory dashboards where rendering speed matters more than fully vector exports.
Scattergl uses WebGL, making it suitable for plotting larger datasets with improved rendering speed and interactivity. It can represent points or lines through the trace's mode setting.
Follow-up: When would regular Scatter be preferable? Use it when fully vector output is required, such as publication-quality SVG or PDF graphics.
A Scattergl trace is created through plotly.graph_objects and added to a Figure, for example with x and y arrays plus mode='lines+markers'. The resulting figure can then be displayed with fig.show().
Follow-up: How can a Plotly Express chart be made to avoid WebGL? Set its render_mode to 'svg' when constructing the chart.
Scattergl is particularly useful for large datasets because WebGL can render more data interactively than the standard SVG-based Scatter trace. Its main trade-off is that exported vector files may contain rasterized content.
Follow-up: What causes rasterized markers in an exported SVG or PDF? A WebGL trace such as Scattergl is being rendered as pixels during export.
go.Scatterplotly.express.scatterplotly.express.linego.Figure