Comparing WebGL vs SVG in Python/v3
Comparing WebGL with Scattergl() to SVG with Scatter() in Python with Plotly.
Note: this page is part of the documentation for version 3 of Plotly.py, which is not the most recent version.
See our Version 4 Migration Guide for information about how to upgrade.
See our Version 4 Migration Guide for information about how to upgrade.
Comparing Scatter Plots with 75,000 Random Points¶
Now in Ploty you can implement WebGL with Scattergl()
in place of Scatter()
for increased speed, improved interactivity, and the ability to plot even more data!
WebGL¶
In [1]:
import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np
N = 75000
trace = go.Scattergl(
x = np.random.randn(N),
y = np.random.randn(N),
mode = 'markers',
marker = dict(
line = dict(
width = 1,
color = '#404040')
)
)
data = [trace]
layout = dict(title = 'WEBGL')
fig = dict(data=data, layout=layout)
py.iplot(data, filename='webgl75')
Out[1]:
SVG¶
In [2]:
import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np
N = 75000
trace = go.Scatter(
x = np.random.randn(N),
y = np.random.randn(N),
mode = 'markers',
marker = dict(
line = dict(
width = 1,
color = '#404040')
)
)
data = [trace]
layout = dict(title = 'SVG')
fig = dict(data=data, layout=layout)
py.iplot(fig, filename='svg75')
Out[2]:
References¶
For more information see
Scattergl()
: https://plotly.com/python/reference/#scattergl
Scatter()
: https://plotly.com/python/reference/#scatter