Skip to content

Commit c2d755e

Browse files
committed
remove example + make small changes to metadata
1 parent 7770164 commit c2d755e

File tree

1 file changed

+8
-101
lines changed

1 file changed

+8
-101
lines changed

doc/python/b64.md

Lines changed: 8 additions & 101 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.15.2
9+
jupytext_version: 1.16.3
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,20 +20,21 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.9.0
23+
version: 3.10.0
2424
plotly:
25-
description: How to format axes of 3d plots in Python with Plotly.
26-
display_as: b64
25+
description: How to use typed arrays in Plotly.py
26+
display_as: file_settings
2727
language: python
2828
layout: base
29-
name: b64
30-
order: 1
31-
page_type: example_index
29+
name: Improving Performance with Typed Arrays
30+
order: 39
3231
permalink: python/b64/
3332
thumbnail: thumbnail/b64.png
3433
---
3534

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

3839
```python
3940
import plotly.graph_objects as go
@@ -102,97 +103,3 @@ fig = go.Figure(data=[go.Scatter3d(
102103

103104
fig.show()
104105
```
105-
106-
### Similar example where base64 is automatically applied to pass numpy arrays to plotly.js
107-
108-
```python
109-
import plotly.graph_objects as go
110-
import numpy as np
111-
112-
np.random.seed(1)
113-
114-
N = 10000
115-
116-
x = np.random.randn(N)
117-
y = np.random.randn(N).astype('float32')
118-
z = np.random.randint(size=N, low=0, high=256, dtype='uint8')
119-
c = np.random.randint(size=N, low=-10, high=10, dtype='int8')
120-
121-
fig = go.Figure(data=[go.Scatter3d(
122-
x=x,
123-
y=y,
124-
z=z,
125-
marker=dict(color=c),
126-
mode='markers',
127-
opacity=0.2
128-
)])
129-
130-
fig.show()
131-
```
132-
133-
134-
### Example where base64 is applied to pass 2 dimensional values as typed array objects to plotly.js using shape in the spec
135-
136-
```python
137-
import plotly.graph_objects as go
138-
import numpy as np
139-
from base64 import b64encode
140-
141-
def b64(arr) :
142-
return {
143-
'dtype': str(arr.dtype),
144-
'bdata': b64encode(arr).decode('ascii'),
145-
'shape': None if arr.ndim == 1 else str(arr.shape)[1:-1]
146-
}
147-
148-
np.random.seed(1)
149-
150-
M = 100
151-
N = 200
152-
153-
x = np.arange(0, M, 1, 'int32')
154-
y = np.arange(0, N, 1, 'uint8')
155-
z = np.random.random([N, M])
156-
157-
fig = go.Figure(data=[go.Surface(
158-
x=b64(x),
159-
y=b64(y),
160-
z=b64(z)
161-
)])
162-
163-
fig.show()
164-
```
165-
166-
### Similar example where base64 is automatically applied to pass multi-dimensional numpy arrays to plotly.js
167-
168-
```python
169-
import plotly.graph_objects as go
170-
import numpy as np
171-
from base64 import b64encode
172-
173-
np.random.seed(1)
174-
175-
M = 100
176-
N = 200
177-
178-
x = np.arange(0, M, 1, 'int32')
179-
y = np.arange(0, N, 1, 'uint8')
180-
z = np.random.random([N, M])
181-
182-
fig = go.Figure(data=[go.Surface(
183-
x=x,
184-
y=y,
185-
z=z
186-
)])
187-
188-
fig.show()
189-
```
190-
191-
192-
```python
193-
194-
```
195-
196-
```python
197-
198-
```

0 commit comments

Comments
 (0)