10000 config surface contour levels · plotly/plotly.py-docs@c205bba · GitHub
[go: up one dir, main page]

Skip to content

Commit c205bba

Browse files
author
mahdis-z
committed
config surface contour levels
1 parent 0f220fc commit c205bba

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

python/3d-surface-plots.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,35 @@ fig.update_layout(title='Mt Bruno Elevation', autosize=False,
7676

7777
fig.show()
7878
```
79+
#### Configure Surface Contour Levels
80+
This example shows how to slice the surface graph on the desired position for each of x, y and z axis. [contours.x.start](https://plot.ly/python/reference/#surface-contours-x-start) sets the starting contour level value, `end` sets the end of it, and `size` sets the step between each contour level.
7981

82+
```python
83+
import plotly.graph_objects as go
84+
85+
fig = go.Figure(go.Surface(
86+
contours = {
87+
"x": {"show": True, "start": 1.5, "end": 2, "size": 0.04},
88+
"z": {"show": True, "start": 0.5, "end": 0.8, "size": 0.05}
89+
},
90+
x = [1,2,3,4,5],
91+
y = [1,2,3,4,5],
92+
z = [
93+
[0, 1, 0, 1, 0],
94+
[1, 0, 1, 0, 1],
95+
[0, 1, 0, 1, 0],
96+
[1, 0, 1, 0, 1],
97+
[0, 1, 0, 1, 0]
98+
]))
99+
fig.update_layout(
100+
scene = {
101+
"xaxis": {"nticks": 20},
102+
"zaxis": {"nticks": 4},
103+
'camera_eye': {"x": 0, "y": -1, "z": 0.5},
104+
"aspectratio": {"x": 1, "y": 1, "z": 0.2}
105+
})
106+
fig.show()
107+
```
80108
#### Multiple 3D Surface Plots
81109

82110
```python

0 commit comments

Comments
 (0)
0