Using 'graph' for 3D representation.
8 次查看(过去 30 天)
显示 更早的评论
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'.
0 个评论
采纳的回答
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.
更多回答(2 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!