Skip to content

Add performance doc #4769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Nov 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7770164
add examples using base64
archmoj Jan 9, 2024
c2d755e
remove example + make small changes to metadata
LiamConnors Sep 17, 2024
d0bc21b
add back correct examples
LiamConnors Sep 17, 2024
fb0a5d8
add content for numpy arrays
LiamConnors Sep 18, 2024
49ae498
fix typo
LiamConnors Sep 19, 2024
589d105
rename file
LiamConnors Sep 19, 2024
79afc5c
update titles and link
LiamConnors Sep 19, 2024
af1c4a4
fix typo and shorten content
LiamConnors Sep 19, 2024
170d7f9
Update numpy-arrays.md
LiamConnors Sep 19, 2024
7a67f81
merge performance content
LiamConnors Sep 23, 2024
f75521c
add intro and restructure svg intro
LiamConnors Sep 23, 2024
c895f10
Update webgl-vs-svg.md
LiamConnors Sep 23, 2024
77d7aa3
Update webgl-vs-svg.md
LiamConnors Oct 3, 2024
c1e43e7
Update webgl-vs-svg.md
LiamConnors Oct 3, 2024
bdfd6af
Update doc/python/webgl-vs-svg.md
LiamConnors Oct 3, 2024
8a3769c
Update doc/python/webgl-vs-svg.md
LiamConnors Oct 3, 2024
cf7ac59
change order of dtypes + mention specifying dtype in numpy
LiamConnors Oct 10, 2024
02a9b28
add link to numpy reference docs
LiamConnors Oct 22, 2024
6c6c27b
Merge branch 'master' into add-base64-docs
LiamConnors Nov 1, 2024
56bb8fc
remove extra webgl examples
LiamConnors Nov 4, 2024
cdd7839
shorten webgl content
LiamConnors Nov 4, 2024
9ee6b26
small edits + remove extra example
LiamConnors Nov 4, 2024
1325ac1
rename file
LiamConnors Nov 4, 2024
24021f3
add update to types of series
LiamConnors Nov 4, 2024
f60f02c
Merge branch 'version-6-migration' into add-base64-docs
LiamConnors Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove example + make small changes to metadata
  • Loading branch information
LiamConnors committed Sep 17, 2024
commit c2d755e14b25c28030ede373e8b28ae99bf906c0
109 changes: 8 additions & 101 deletions doc/python/b64.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.15.2
jupytext_version: 1.16.3
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand All @@ -20,20 +20,21 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.9.0
version: 3.10.0
plotly:
description: How to format axes of 3d plots in Python with Plotly.
display_as: b64
description: How to use typed arrays in Plotly.py
display_as: file_settings
language: python
layout: base
name: b64
order: 1
page_type: example_index
name: Improving Performance with Typed Arrays
order: 39
permalink: python/b64/
thumbnail: thumbnail/b64.png
---

```python
### Simple example showing how arrays of numbers could be passed as base64 typed array objects to plotly.js
```

```python
import plotly.graph_objects as go
Expand Down Expand Up @@ -102,97 +103,3 @@ fig = go.Figure(data=[go.Scatter3d(

fig.show()
```

### Similar example where base64 is automatically applied to pass numpy arrays to plotly.js

```python
import plotly.graph_objects as go
import numpy as np

np.random.seed(1)

N = 10000

x = np.random.randn(N)
y = np.random.randn(N).astype('float32')
z = np.random.randint(size=N, low=0, high=256, dtype='uint8')
c = np.random.randint(size=N, low=-10, high=10, dtype='int8')

fig = go.Figure(data=[go.Scatter3d(
x=x,
y=y,
z=z,
marker=dict(color=c),
mode='markers',
opacity=0.2
)])

fig.show()
```


### Example where base64 is applied to pass 2 dimensional values as typed array objects to plotly.js using shape in the spec

```python
import plotly.graph_objects as go
import numpy as np
from base64 import b64encode

def b64(arr) :
return {
'dtype': str(arr.dtype),
'bdata': b64encode(arr).decode('ascii'),
'shape': None if arr.ndim == 1 else str(arr.shape)[1:-1]
}

np.random.seed(1)

M = 100
N = 200

x = np.arange(0, M, 1, 'int32')
y = np.arange(0, N, 1, 'uint8')
z = np.random.random([N, M])

fig = go.Figure(data=[go.Surface(
x=b64(x),
y=b64(y),
z=b64(z)
)])

fig.show()
```

### Similar example where base64 is automatically applied to pass multi-dimensional numpy arrays to plotly.js

```python
import plotly.graph_objects as go
import numpy as np
from base64 import b64encode

np.random.seed(1)

M = 100
N = 200

x = np.arange(0, M, 1, 'int32')
y = np.arange(0, N, 1, 'uint8')
z = np.random.random([N, M])

fig = go.Figure(data=[go.Surface(
x=x,
y=y,
z=z
)])

fig.show()
```


```python

```

```python

```