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
+17-4Lines changed: 17 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -34,9 +34,22 @@ jupyter:
34
34
thumbnail: thumbnail/webgl.jpg
35
35
---
36
36
37
-
### SVG and canvas/WebGL: two browser capabilities for rendering
37
+
In some examples in the documentation, you'll see figures created using data structures that are native to Python, such as lists and tuples, and which use trace types that render as SVGs.
38
38
39
-
`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:
39
+
This will work fine for many use cases, but may not provide optimal performance with larger datasets.
40
+
41
+
For improved performance, consider using WebGL-based traces and NumPy arrays.
42
+
43
+
<!-- #region -->
44
+
## WebGL
45
+
46
+
`plotly` figures are rendered by web browsers, which broadly speaking have two families of capabilities for rendering graphics:
47
+
48
+
- The SVG API, which supports vector rendering
49
+
- The Canvas API, which supports raster rendering, and can exploit GPU hardware acceleration via a browser technology known as WebGL.
50
+
51
+
52
+
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:
40
53
41
54
* Accelerated versions of SVG trace types: `scattergl`, `scatterpolargl`, `heatmapgl`
42
55
* High-performance multidimensional trace types: `splom`, or `parcoords`
@@ -71,7 +84,7 @@ If you encounter WebGL context limits when using WebGL-based figures, you can us
71
84
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.
72
85
73
86
In a Jupyter notebook environment that supports magic commands, you can load it with the [HTML magic command](https://ipython.readthedocs.io/en/stable/interactive/magics.html#cellmagic-html):
74
-
87
+
<!-- #endregion -->
75
88
76
89
```
77
90
%%html
@@ -201,7 +214,7 @@ See https://plotly.com/python/reference/scattergl/ for more information and char
201
214
202
215
## NumPy Arrays
203
216
204
-
*New in Plotly.py 6.0**
217
+
*New in Plotly.py 6.0*
205
218
206
219
Improve the performance of generating Plotly figures that use a large number of data points by using NumPy arrays and other objects that can be converted to NumPy arrays, such as Pandas Series and Index objects.
0 commit comments