Using 'graph' for 3D representation.

조회 수: 2 (최근 30일)
Ginner
Ginner 2015년 10월 2일
답변: Steven Lord 2017년 1월 27일
I want to make a 3D map with the 'graph' function introduced in matlab 2015b, is this possible? or is there a workaround? It seems that I can not add 'ZData' as it is.
Thank you.
What i am trying to do:
s = [1 1 1 2 2 3];
t = [2 3 4 3 4 4];
G = graph(s,t);
x = [0 1 .5 .5];
y = [0 0 1 .5];
z = [0 0 0 1];
plot(G, 'XData', x, 'YData', y, 'ZData', z)
Edit: I have also tried with 'plot3'.

채택된 답변

Walter Roberson
Walter Roberson 2015년 10월 2일
Sorry, the underlying graphics object http://www.mathworks.com/help/matlab/ref/graphplot-properties.html does not have a ZData property.
  댓글 수: 1
Ginner
Ginner 2015년 10월 2일
Hmm... That's what I was afraid to hear.
Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Christine Tobler
Christine Tobler 2016년 1월 7일
You can get plot3 to show you the structure you're looking for as follows:
>> xx = [x(s); x(t)]
>> yy = [y(s); y(t)]
>> zz = [z(s); z(t)]
>> plot3(xx, yy, zz, 'k')
This plots all your edges as individual line segments in 3D. I'm setting the color to black because otherwise each line has a different color.

Steven Lord
Steven Lord 2017년 1월 27일
The ability to visualize graph and digraph objects in 3-D was added to MATLAB in release R2016b.

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by