8000 added 3d surface example by emmanuelle · Pull Request #196 · plotly/plotly.py-docs · GitHub
[go: up one dir, main page]

Skip to content

added 3d surface example #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion python/3d-surface-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.6.7
version: 3.7.3
plotly:
description: How to make 3D-surface plots in Python
display_as: 3d_charts
Expand Down Expand Up @@ -52,6 +52,31 @@ fig.update_layout(title='Mt Bruno Elevation', autosize=False,
fig.show()
```

### Passing x and y data to 3D Surface Plot

If you do not specify `x` and `y` coordinates, integer indices are used for the `x` and `y` axis. You can also pass `x` and `y` values to `go.Surface`.

```python
import plotly.graph_objects as go

import pandas as pd
import numpy as np

# Read data from a csv
z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv')
z = z_data.values
sh_0, sh_1 = z.shape
x, y = np.linspace(0, 1, sh_0), np.linspace(0, 1, sh_1)

fig = go.Figure(data=[go.Surface(z=z, x=x, y=y)])

fig.update_layout(title='Mt Bruno Elevation', autosize=False,
width=500, height=500,
margin=dict(l=65, r=50, b=65, t=90))

fig.show()
```

#### Surface Plot With Contours


Expand Down
0