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 bf7178b

Browse files
committedSep 4, 2019
added opacity example
1 parent 55325b6 commit bf7178b

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed
 

‎python/3d-isosurface-plots.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fig= go.Figure(data=go.Isosurface(
5252
z=[1,1,0,0,1,1,0,0],
5353
value=[1,2,3,4,5,6,7,8],
5454
isomin=2,
55-
isomax=6
55+
isomax=6,
5656
))
5757

5858
fig.show()
@@ -108,6 +108,31 @@ fig = go.Figure(data=go.Isosurface(
108108
fig.show()
109109
```
110110

111+
### Changing the opacity of isosurfaces
112+
113+
```python
114+
import plotly.graph_objects as go
115+
import numpy as np
116+
117+
X, Y, Z = np.mgrid[-5:5:40j, -5:5:40j, -5:5:40j]
118+
119+
# ellipsoid
120+
values = X * X * 0.5 + Y * Y + Z * Z * 2
121+
122+
fig = go.Figure(data=go.Isosurface(
123+
x=X.flatten(),
124+
y=Y.flatten(),
125+
z=Z.flatten(),
126+
value=values.flatten(),
127+
opacity=0.6,
128+
isomin=10,
129+
isomax=50,
130+
surface_count=3,
131+
caps=dict(x_show=False, y_show=False)
132+
))
133+
fig.show()
134+
```
135+
111136
#### Isosurface with Addtional Slices
112137

113138
Here we visualize slices parallel to the axes on top of isosurfaces. For a clearer visualization, the `fill` ratio of isosurfaces is decreased below 1 (completely filled).

0 commit comments

Comments
 (0)
Please sign in to comment.