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 plotly.express as px

import pandas as pd
import numpy as np
np.random.seed(1)

N = 100000

df = pd.DataFrame(dict(x=np.random.randn(N),
                       y=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'))

fig.show()