Skip to content

Commit 8f27923

Browse files
committed
Update webgl-vs-svg.md
1 parent 41129d7 commit 8f27923

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

doc/python/webgl-vs-svg.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
9-
jupytext_version: 1.1.7
8+
format_version: '1.3'
9+
jupytext_version: 1.14.6
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,20 +20,21 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.6.5
23+
version: 3.10.11
2424
plotly:
25-
description: Using WebGL for increased speed, improved interactivity, and
26-
the ability to plot even more data!
25+
description: Using WebGL for increased speed, improved interactivity, and the
26+
ability to plot even more data!
2727
display_as: basic
2828
language: python
2929
layout: base
3030
name: WebGL vs SVG
3131
order: 14
3232
permalink: python/webgl-vs-svg/
33-
thumbnail: thumbnail/webgl.jpg
3433
redirect_from: python/compare-webgl-svg/
34+
thumbnail: thumbnail/webgl.jpg
3535
---
3636

37+
<!-- #region -->
3738
### SVG and canvas/WebGL: two browser capabilities for rendering
3839

3940
`plotly` figures are rendered by web browsers, which broadly speaking have two families of capabilities for rendering graphics: the SVG API which supports vector rendering, and the Canvas API which supports raster rendering, and can exploit GPU hardware acceleration via a browser technology known as WebGL. Each `plotly` trace type is primarily rendered with either SVG or WebGL, although WebGL-powered traces also use some SVG. The following trace types use WebGL for part or all of the rendering:
@@ -58,6 +59,15 @@ In addition to the above limitations, the WebGL-powered version of certain SVG-p
5859
* Range breaks on time-series axes are not yet supported
5960
* Axis range heuristics may differ
6061

62+
### Multiple WebGL Contexts
63+
64+
*New in 5.19*
65+
66+
If you encounter WebGL context limits when rendering many WebGL-based figures on one page, you can use [Virtual WebGL](https://github.com/greggman/virtual-webgl).
67+
68+
To use it, in the environment where your Plotly figures are being rendered, load the Virtual WebGL script, "https://unpkg.com/virtual-webgl@1.0.6/src/virtual-webgl.js", for example, using a `<script>` tag.
69+
70+
6171
### WebGL for Scatter Performance
6272

6373
In the examples below we show that it is possible to represent up to around a million points with WebGL-enabled traces.
@@ -71,6 +81,7 @@ The `rendermode` argument to supported Plotly Express functions (e.g. `scatter`
7181
> **Note** The default `rendermode` is `"auto"`, in which case Plotly Express will automatically set `rendermode="webgl"` if the input data is more than 1,000 rows long. If WebGL acceleration is *not* desired in this case, `rendermode` can be forced to `"svg"` for vectorized, if slower, rendering.
7282
7383
Here is an example that creates a 100,000 point scatter plot using Plotly Express with WebGL rendering explicitly enabled.
84+
<!-- #endregion -->
7485

7586
```python
7687
import plotly.express as px

0 commit comments

Comments
 (0)