Skip to content

Commit 2fc83f8

Browse files
committed
Update webgl-vs-svg.md
1 parent 80ce7b5 commit 2fc83f8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

doc/python/webgl-vs-svg.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.6
9+
jupytext_version: 1.16.1
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -34,7 +34,6 @@ jupyter:
3434
thumbnail: thumbnail/webgl.jpg
3535
---
3636

37-
<!-- #region -->
3837
### SVG and canvas/WebGL: two browser capabilities for rendering
3938

4039
`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:
@@ -69,6 +68,12 @@ If you encounter WebGL context limits when rendering WebGL-based figures on one
6968

7069
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.
7170

71+
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):
72+
73+
```
74+
%%html
75+
<script src=“https://unpkg.com/virtual-webgl@1.0.6/src/virtual-webgl.js”></script>
76+
```
7277

7378
### WebGL for Scatter Performance
7479

@@ -83,7 +88,6 @@ The `rendermode` argument to supported Plotly Express functions (e.g. `scatter`
8388
> **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.
8489
8590
Here is an example that creates a 100,000 point scatter plot using Plotly Express with WebGL rendering explicitly enabled.
86-
<!-- #endregion -->
8791

8892
```python
8993
import plotly.express as px

0 commit comments

Comments
 (0)