Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 806bc0f

Browse files
committed
js example using surface contours attribute
1 parent 63cc683 commit 806bc0f

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: Surface Plot With Contours
3+
plot_url: https://codepen.io/plotly/embed/dgvpjE/?height=601&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: 3d-surface
6+
order: 0.5
7+
sitemap: false
8+
arrangement: horizontal
9+
markdown_content: |
10+
Display and customize contour data for each axis using the `contours` attribute ([reference](plot.ly/javascript/reference/#surface-contours)).
11+
12+
---
13+
14+
Plotly.d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv', function(err, rows){
15+
function unpack(rows, key) {
16+
return rows.map(function(row) { return row[key]; });
17+
}
18+
var z_data=[ ]
19+
for(i=0;i<24;i++)
20+
{
21+
z_data.push(unpack(rows,i));
22+
}
23+
24+
var data = [{
25+
z: z_data,
26+
type: 'surface',
27+
contours: {
28+
z: {
29+
show:true,
30+
usecolormap: true,
31+
highlightcolor:"#42f462",
32+
project:{z: true}
33+
}
34+
}
35+
}];
36+
37+
var layout = {
38+
title: 'Mt Bruno Elevation With Projected Contours',
39+
scene: {camera: {eye: {x: 1.87, y: 0.88, z: -0.64}}},
40+
autosize: false,
41+
width: 500,
42+
height: 500,
43+
margin: {
44+
l: 65,
45+
r: 50,
46+
b: 65,
47+
t: 90,
48+
}
49+
};
50+
51+
Plotly.newPlot('myDiv', data, layout);
52+
});

0 commit comments

Comments
 (0)