From c205bba919864e719ba14bb133e7bd990fd8a438 Mon Sep 17 00:00:00 2001 From: mahdis-z Date: Wed, 27 Nov 2019 15:20:48 -0500 Subject: [PATCH 1/2] config surface contour levels --- python/3d-surface-plots.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/python/3d-surface-plots.md b/python/3d-surface-plots.md index ceae29554..f99362643 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}, + "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 From f5de7092d95c4633b5691e331ff74c93f1e9cecb Mon Sep 17 00:00:00 2001 From: mahdis-z Date: Fri, 29 Nov 2019 14:54:36 -0500 Subject: [PATCH 2/2] chnage of color --- python/3d-surface-plots.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/3d-surface-plots.md b/python/3d-surface-plots.md index f99362643..d5a4d1771 100644 --- a/python/3d-surface-plots.md +++ b/python/3d-surface-plots.md @@ -84,7 +84,7 @@ import plotly.graph_objects as go fig = go.Figure(go.Surface( contours = { - "x": {"show": True, "start": 1.5, "end": 2, "size": 0.04}, + "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],