You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/webgl-vs-svg.md
+18-7Lines changed: 18 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,10 @@ jupyter:
5
5
text_representation:
6
6
extension: .md
7
7
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
10
10
kernelspec:
11
-
display_name: Python 3
11
+
display_name: Python 3 (ipykernel)
12
12
language: python
13
13
name: python3
14
14
language_info:
@@ -20,20 +20,21 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.6.5
23
+
version: 3.10.11
24
24
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!
27
27
display_as: basic
28
28
language: python
29
29
layout: base
30
30
name: WebGL vs SVG
31
31
order: 14
32
32
permalink: python/webgl-vs-svg/
33
-
thumbnail: thumbnail/webgl.jpg
34
33
redirect_from: python/compare-webgl-svg/
34
+
thumbnail: thumbnail/webgl.jpg
35
35
---
36
36
37
+
<!-- #region -->
37
38
### SVG and canvas/WebGL: two browser capabilities for rendering
38
39
39
40
`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
58
59
* Range breaks on time-series axes are not yet supported
59
60
* Axis range heuristics may differ
60
61
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
+
61
71
### WebGL for Scatter Performance
62
72
63
73
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`
71
81
> **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.
72
82
73
83
Here is an example that creates a 100,000 point scatter plot using Plotly Express with WebGL rendering explicitly enabled.
0 commit comments