diff --git a/python/3d-surface-plots.md b/python/3d-surface-plots.md index ceae29554..d5a4d1771 100644 --- a/python/3d-surface-plots.md +++ b/python/3d-surface-plots.md @@ -76,7 +76,35 @@ fig.update_layout(title='Mt Bruno Elevation', autosize=False, fig.show() ``` +#### Configure Surface Contour Levels +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. +```python +import plotly.graph_objects as go + +fig = go.Figure(go.Surface( + contours = { + "x": {"show": True, "start": 1.5, "end": 2, "size": 0.04, "color":"white"}, + "z": {"show": True, "start": 0.5, "end": 0.8, "size": 0.05} + }, + x = [1,2,3,4,5], + y = [1,2,3,4,5], + z = [ + [0, 1, 0, 1, 0], + [1, 0, 1, 0, 1], + [0, 1, 0, 1, 0], + [1, 0, 1, 0, 1], + [0, 1, 0, 1, 0] + ])) +fig.update_layout( + scene = { + "xaxis": {"nticks": 20}, + "zaxis": {"nticks": 4}, + 'camera_eye': {"x": 0, "y": -1, "z": 0.5}, + "aspectratio": {"x": 1, "y": 1, "z": 0.2} + }) +fig.show() +``` #### Multiple 3D Surface Plots ```python