Skip to content

Latest commit

 

History

History
105 lines (84 loc) · 2.02 KB

compare-webgl-svg.md

File metadata and controls

105 lines (84 loc) · 2.02 KB
jupyter
jupytext kernelspec language_info plotly
notebook_metadata_filter text_representation
all
extension format_name format_version jupytext_version
.md
markdown
1.1
1.1.7
display_name language name
Python 3
python
python3
codemirror_mode file_extension mimetype name nbconvert_exporter pygments_lexer version
name version
ipython
3
.py
text/x-python
python
python
ipython3
3.6.5
description has_thumbnail language layout name page_type permalink thumbnail
Comparing WebGL with Scattergl() to SVG with Scatter() in Python with Plotly.
false
python
base
Comparing WebGL vs SVG
example_index
python/compare-webgl-svg/
/images/static-image

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

import plotly.graph_objects as go

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

N = 75000

fig = go.Figure()
fig.add_trace(
    go.Scattergl(
        x = np.random.randn(N),
        y = np.random.randn(N),
        mode = 'markers',
        marker = dict(
            line = dict(
                width = 1,
                color = 'DarkSlateGrey')
        )
    )
)

fig.update_layout(title_text = 'WebGL')

fig.show()

SVG

import plotly.graph_objects as go

import numpy as np

N = 75000

fig = go.Figure()
fig.add_trace(
    go.Scatter(
        x = np.random.randn(N),
        y = np.random.randn(N),
        mode = 'markers',
        marker = dict(
            line = dict(
                width = 1,
                color = 'DarkSlateGrey')
        )
    )
)

fig.update_layout(title_text = 'SVG')

fig.show()

References

For more information see
Scattergl() : https://plotly.com/python/reference/scattergl/
Scatter() : https://plotly.com/python/reference/scatter/