Skip to content

Commit f75521c

Browse files
committed
add intro and restructure svg intro
1 parent 7a67f81 commit f75521c

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

doc/python/webgl-vs-svg.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,22 @@ jupyter:
3434
thumbnail: thumbnail/webgl.jpg
3535
---
3636

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.
3838

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:
4053

4154
* Accelerated versions of SVG trace types: `scattergl`, `scatterpolargl`, `heatmapgl`
4255
* 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
7184
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.
7285

7386
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 -->
7588

7689
```
7790
%%html
@@ -201,7 +214,7 @@ See https://plotly.com/python/reference/scattergl/ for more information and char
201214

202215
## NumPy Arrays
203216

204-
*New in Plotly.py 6.0**
217+
*New in Plotly.py 6.0*
205218

206219
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.
207220

0 commit comments

Comments
 (0)