Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9d019c7

Browse files
committedSep 9, 2019
reduced grid size
1 parent ac0f4d2 commit 9d019c7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎python/3d-volume.md

Lines changed: 7 additions & 7 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.1'
9-
jupytext_version: 1.1.1
9+
jupytext_version: 1.2.3
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -44,7 +44,7 @@ In the three examples below, note that the default colormap is different whether
4444
```python
4545
import plotly.graph_objects as go
4646
import numpy as np
47-
X, Y, Z = np.mgrid[-8:8:50j, -8:8:50j, -8:8:50j]
47+
X, Y, Z = np.mgrid[-8:8:40j, -8:8:40j, -8:8:40j]
4848
values = np.sin(X*Y*Z) / (X*Y*Z)
4949

5050
fig = go.Figure(data=go.Volume(
@@ -63,7 +63,7 @@ fig.show()
6363
```python
6464
import plotly.graph_objects as go
6565
import numpy as np
66-
X, Y, Z = np.mgrid[-1:1:50j, -1:1:50j, -1:1:50j]
66+
X, Y, Z = np.mgrid[-1:1:30j, -1:1:30j, -1:1:30j]
6767
values = np.sin(np.pi*X) * np.cos(np.pi*Z) * np.sin(np.pi*Y)
6868

6969
fig = go.Figure(data=go.Volume(
@@ -85,13 +85,13 @@ import plotly.graph_objects as go
8585

8686
# Generate nicely looking random 3D-field
8787
np.random.seed(0)
88-
l = 50
88+
l = 30
8989
X, Y, Z = np.mgrid[:l, :l, :l]
9090
vol = np.zeros((l, l, l))
9191
pts = (l * np.random.rand(3, 15)).astype(np.int)
9292
vol[tuple(indices for indices in pts)] = 1
9393
from scipy import ndimage
94-
vol = ndimage.gaussian_filter(vol, 7)
94+
vol = ndimage.gaussian_filter(vol, 4)
9595
vol /= vol.max()
9696

9797
fig = go.Figure(data=go.Volume(
@@ -122,7 +122,7 @@ fig = make_subplots(
122122

123123
import numpy as np
124124

125-
X, Y, Z = np.mgrid[-8:8:50j, -8:8:50j, -8:8:50j]
125+
X, Y, Z = np.mgrid[-8:8:30j, -8:8:30j, -8:8:30j]
126126
values = np.sin(X*Y*Z) / (X*Y*Z)
127127

128128

@@ -150,7 +150,7 @@ It is also possible to define a custom opacity scale, mapping scalar values to r
150150
```python
151151
import plotly.graph_objects as go
152152
import numpy as np
153-
X, Y, Z = np.mgrid[-1:1:50j, -1:1:50j, -1:1:50j]
153+
X, Y, Z = np.mgrid[-1:1:30j, -1:1:30j, -1:1:30j]
154154
values = np.sin(np.pi*X) * np.cos(np.pi*Z) * np.sin(np.pi*Y)
155155

156156
fig = go.Figure(data=go.Volume(

0 commit comments

Comments
 (0)
Please sign in to comment.