#!/usr/bin/env python
# coding: utf-8
# ### 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')
# ### 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')
# ### References
# For more information see
# `Scattergl()` : https://plotly.com/python/reference/#scattergl
# `Scatter()` : https://plotly.com/python/reference/#scatter
# In[4]:
from IPython.display import display, HTML
display(HTML(''))
display(HTML(''))
get_ipython().system(' pip install git+https://github.com/plotly/publisher.git --upgrade')
import publisher
publisher.publish(
'comparewebgl.ipynb', 'python/compare-webgl-svg/', 'Python Comparing WebGL vs SVG | plotly',
'Comparing WebGL with Scattergl() to SVG with Scatter() in Python with Plotly.',
title = 'Comparing WebGL vs SVG | plotly',
name = 'Comparing WebGL vs SVG',
language='python')
# In[ ]: