Show Sidebar Hide Sidebar

WebGL vs SVG in Python

Implement WebGL for increased speed, improved interactivity, and the ability to plot even more data!

Compare WebGL and SVG

Checkout this notebook to compare WebGL and SVG scatter plots with 75,000 random data points

WebGL with plotly express

The rendermode argument to supported plotly express functions can be used to enable WebGL rendering.

Here is an example that creates a 100,000 point scatter plot using plotly express with WebGL rendering enabled.

In [1]:
import as px

import pandas as pd
import numpy as np

N = 100000

df = pd.DataFrame(dict(x=np.random.randn(N),

fig = px.scatter(df, x="x", y="y", render_mode='webgl')

fig.update_traces(marker_line=dict(width=1, color='DarkSlateGray'))