How to draw 3D Surface Chart in Plotly by giving X Y Z axis
I have a table of data as follows
X Y Z
12.22 6.38 9.93
8.97 10.37 8.66
8.8 7.6 10.26
10.96 10.18 8.99
8.14 9.77 11.3
17.79 12.99 11.05
11.04 12.93 11.15
11.97 9.79 10.73
10.29 10.2 10.17
9.74 4.58 9.32
10.32 10.47 10.24
9.15 13.59 9.66
8.1 5.85 9.23
6.55 10.58 9.69
18.78 8.29 9.39
Then I created a grid, X horizontally, Z vertically, filled Y values in the cells.
After I selected the data and choose the 3D Surface Chart, It generated a chart as below:
I tried the example below where the first number in Z is empty:
var data = [
z: [[,6.55,8.1,8.14, 8.8,8.97,9.15,9.74,10.29,10.32,10.96,11.04,11.97,12.22,17.79,18.78],
[8.66,0,0,0,0,10.47,0,0,0,0,0,0,0,0,0,0],
[8.99,0,0,0,0,0,0,0,0,0,10.18,0,0,0,0,0],
[9.23,0,5.85,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.32,0,0,0,0,0,0,4.58,0,0,0,0,0,0,0,0],
[9.39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8.29],
[9.66,0,0,0,0,0,13.59,0,0,0,0,0,0,0,0,0],
[9.69,10.58,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.93,0,0,0,0,0,0,0,0,0,0,0,0,6.38,0,0],
[10.17,0,0,0,0,0,0,0,10.2,0,0,0,0,0,0,0],
[10.24,0,0,0,0,0,0,0,0, 10.47,0,0,0,0,0,0],
[10.26,0,0,0,7.6,0,0,0,0,0,0,0,0,0,0,0],
[10.73,0,0,0,0,0,0,0,0,0,0,0,9.79,0,0,0],
[11.05,0,0,0,0,0,0,0,0,0,0,0,0,0,12.99,0],
[11.15,0,0,0,0,0,0,0,0,0,0,12.93,0,0,0,0],
[11.3,0,0,9.77,0,0,0,0,0,0,0,0,0,0,0,0]],
type: 'surface'
];
var layout =
title: 'Mt Bruno Elevation',
autosize: false,
width: 700,
height: 700,
margin:
l: 130,
r: 100,
b: 130,
t: 180,
;
Plotly.newPlot('example', data, layout);
It generated a Chart as below which looks wrong:
I don't know if I generated Z data wrong. Can anyone tell me which part I am doing it wrong? or Suggest me a way to generate 3d surface similar to Excel chart
javascript charts plotly plotly.js
add a comment |
I have a table of data as follows
X Y Z
12.22 6.38 9.93
8.97 10.37 8.66
8.8 7.6 10.26
10.96 10.18 8.99
8.14 9.77 11.3
17.79 12.99 11.05
11.04 12.93 11.15
11.97 9.79 10.73
10.29 10.2 10.17
9.74 4.58 9.32
10.32 10.47 10.24
9.15 13.59 9.66
8.1 5.85 9.23
6.55 10.58 9.69
18.78 8.29 9.39
Then I created a grid, X horizontally, Z vertically, filled Y values in the cells.
After I selected the data and choose the 3D Surface Chart, It generated a chart as below:
I tried the example below where the first number in Z is empty:
var data = [
z: [[,6.55,8.1,8.14, 8.8,8.97,9.15,9.74,10.29,10.32,10.96,11.04,11.97,12.22,17.79,18.78],
[8.66,0,0,0,0,10.47,0,0,0,0,0,0,0,0,0,0],
[8.99,0,0,0,0,0,0,0,0,0,10.18,0,0,0,0,0],
[9.23,0,5.85,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.32,0,0,0,0,0,0,4.58,0,0,0,0,0,0,0,0],
[9.39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8.29],
[9.66,0,0,0,0,0,13.59,0,0,0,0,0,0,0,0,0],
[9.69,10.58,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.93,0,0,0,0,0,0,0,0,0,0,0,0,6.38,0,0],
[10.17,0,0,0,0,0,0,0,10.2,0,0,0,0,0,0,0],
[10.24,0,0,0,0,0,0,0,0, 10.47,0,0,0,0,0,0],
[10.26,0,0,0,7.6,0,0,0,0,0,0,0,0,0,0,0],
[10.73,0,0,0,0,0,0,0,0,0,0,0,9.79,0,0,0],
[11.05,0,0,0,0,0,0,0,0,0,0,0,0,0,12.99,0],
[11.15,0,0,0,0,0,0,0,0,0,0,12.93,0,0,0,0],
[11.3,0,0,9.77,0,0,0,0,0,0,0,0,0,0,0,0]],
type: 'surface'
];
var layout =
title: 'Mt Bruno Elevation',
autosize: false,
width: 700,
height: 700,
margin:
l: 130,
r: 100,
b: 130,
t: 180,
;
Plotly.newPlot('example', data, layout);
It generated a Chart as below which looks wrong:
I don't know if I generated Z data wrong. Can anyone tell me which part I am doing it wrong? or Suggest me a way to generate 3d surface similar to Excel chart
javascript charts plotly plotly.js
add a comment |
I have a table of data as follows
X Y Z
12.22 6.38 9.93
8.97 10.37 8.66
8.8 7.6 10.26
10.96 10.18 8.99
8.14 9.77 11.3
17.79 12.99 11.05
11.04 12.93 11.15
11.97 9.79 10.73
10.29 10.2 10.17
9.74 4.58 9.32
10.32 10.47 10.24
9.15 13.59 9.66
8.1 5.85 9.23
6.55 10.58 9.69
18.78 8.29 9.39
Then I created a grid, X horizontally, Z vertically, filled Y values in the cells.
After I selected the data and choose the 3D Surface Chart, It generated a chart as below:
I tried the example below where the first number in Z is empty:
var data = [
z: [[,6.55,8.1,8.14, 8.8,8.97,9.15,9.74,10.29,10.32,10.96,11.04,11.97,12.22,17.79,18.78],
[8.66,0,0,0,0,10.47,0,0,0,0,0,0,0,0,0,0],
[8.99,0,0,0,0,0,0,0,0,0,10.18,0,0,0,0,0],
[9.23,0,5.85,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.32,0,0,0,0,0,0,4.58,0,0,0,0,0,0,0,0],
[9.39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8.29],
[9.66,0,0,0,0,0,13.59,0,0,0,0,0,0,0,0,0],
[9.69,10.58,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.93,0,0,0,0,0,0,0,0,0,0,0,0,6.38,0,0],
[10.17,0,0,0,0,0,0,0,10.2,0,0,0,0,0,0,0],
[10.24,0,0,0,0,0,0,0,0, 10.47,0,0,0,0,0,0],
[10.26,0,0,0,7.6,0,0,0,0,0,0,0,0,0,0,0],
[10.73,0,0,0,0,0,0,0,0,0,0,0,9.79,0,0,0],
[11.05,0,0,0,0,0,0,0,0,0,0,0,0,0,12.99,0],
[11.15,0,0,0,0,0,0,0,0,0,0,12.93,0,0,0,0],
[11.3,0,0,9.77,0,0,0,0,0,0,0,0,0,0,0,0]],
type: 'surface'
];
var layout =
title: 'Mt Bruno Elevation',
autosize: false,
width: 700,
height: 700,
margin:
l: 130,
r: 100,
b: 130,
t: 180,
;
Plotly.newPlot('example', data, layout);
It generated a Chart as below which looks wrong:
I don't know if I generated Z data wrong. Can anyone tell me which part I am doing it wrong? or Suggest me a way to generate 3d surface similar to Excel chart
javascript charts plotly plotly.js
I have a table of data as follows
X Y Z
12.22 6.38 9.93
8.97 10.37 8.66
8.8 7.6 10.26
10.96 10.18 8.99
8.14 9.77 11.3
17.79 12.99 11.05
11.04 12.93 11.15
11.97 9.79 10.73
10.29 10.2 10.17
9.74 4.58 9.32
10.32 10.47 10.24
9.15 13.59 9.66
8.1 5.85 9.23
6.55 10.58 9.69
18.78 8.29 9.39
Then I created a grid, X horizontally, Z vertically, filled Y values in the cells.
After I selected the data and choose the 3D Surface Chart, It generated a chart as below:
I tried the example below where the first number in Z is empty:
var data = [
z: [[,6.55,8.1,8.14, 8.8,8.97,9.15,9.74,10.29,10.32,10.96,11.04,11.97,12.22,17.79,18.78],
[8.66,0,0,0,0,10.47,0,0,0,0,0,0,0,0,0,0],
[8.99,0,0,0,0,0,0,0,0,0,10.18,0,0,0,0,0],
[9.23,0,5.85,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.32,0,0,0,0,0,0,4.58,0,0,0,0,0,0,0,0],
[9.39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8.29],
[9.66,0,0,0,0,0,13.59,0,0,0,0,0,0,0,0,0],
[9.69,10.58,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[9.93,0,0,0,0,0,0,0,0,0,0,0,0,6.38,0,0],
[10.17,0,0,0,0,0,0,0,10.2,0,0,0,0,0,0,0],
[10.24,0,0,0,0,0,0,0,0, 10.47,0,0,0,0,0,0],
[10.26,0,0,0,7.6,0,0,0,0,0,0,0,0,0,0,0],
[10.73,0,0,0,0,0,0,0,0,0,0,0,9.79,0,0,0],
[11.05,0,0,0,0,0,0,0,0,0,0,0,0,0,12.99,0],
[11.15,0,0,0,0,0,0,0,0,0,0,12.93,0,0,0,0],
[11.3,0,0,9.77,0,0,0,0,0,0,0,0,0,0,0,0]],
type: 'surface'
];
var layout =
title: 'Mt Bruno Elevation',
autosize: false,
width: 700,
height: 700,
margin:
l: 130,
r: 100,
b: 130,
t: 180,
;
Plotly.newPlot('example', data, layout);
It generated a Chart as below which looks wrong:
I don't know if I generated Z data wrong. Can anyone tell me which part I am doing it wrong? or Suggest me a way to generate 3d surface similar to Excel chart
javascript charts plotly plotly.js
javascript charts plotly plotly.js
edited Nov 12 '18 at 16:35
Erdi Atalay
asked Nov 12 '18 at 8:07
Erdi AtalayErdi Atalay
13
13
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258018%2fhow-to-draw-3d-surface-chart-in-plotly-by-giving-x-y-z-axis%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258018%2fhow-to-draw-3d-surface-chart-in-plotly-by-giving-x-y-z-axis%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown