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

Skip to content

Commit 23dfdd5

Browse files
authored
Merge pull request plotly#1182 from plotly/fixed-ratio-axis-3d
Fixed ratio axis 3d
2 parents c1d6603 + 77ce576 commit 23dfdd5

File tree

5 files changed

+434
-88
lines changed

5 files changed

+434
-88
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
name: Fixed Ratio Axes
3+
plot_url: https://codepen.io/plotly/embed/YRKyeq/?height=500&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: 3d-axes
6+
order: 1.1
7+
sitemap: false
8+
arrangement: horizontal
9+
---
10+
11+
function getrandom(num , mul)
12+
{
13+
var value = [ ]
14+
var i;
15+
for(i=0;i<=num;i++)
16+
{
17+
rand = Math.random() * mul;
18+
value.push(rand);
19+
}
20+
return value;
21+
}
22+
23+
var i;
24+
traces = [];
25+
names = ['cube', 'data', 'auto', 'manual'];
26+
for (i=1; i<5; i++){
27+
traces.push({
28+
x: getrandom(20, 4),
29+
y: getrandom(20, 3),
30+
z: getrandom(20, 5),
31+
opacity:0.5,
32+
mode: "markers",
33+
type: "mesh3d",
34+
scene: "scene" + i,
35+
name: names[i-1]
36+
}
37+
)
38+
}
39+
40+
var layout = {
41+
scene:{
42+
aspectmode:'cube',
43+
domain:{row:0, column:0}
44+
},
45+
scene2:{
46+
aspectmode:'data',
47+
domain:{row:1, column:0}
48+
},
49+
scene3:{
50+
aspectmode:'auto',
51+
domain:{row:0, column:1}
52+
},
53+
scene4:{
54+
aspectmode:'manual',
55+
aspectratio: {x:1, y:1, z:2},
56+
domain: {row:1, column:1}
57+
},
58+
grid:{
59+
pattern: 'independent',
60+
rows:2,
61+
columns:2
62+
},
63+
64+
};
65+
66+
Plotly.plot('myDiv', traces, layout);

0 commit comments

Comments
 (0)