How to connect two scatter 3d plots with lines?

10 ビュー (過去 30 日間)
Jayman
Jayman 2020 年 6 月 20 日
コメント済み: Jayman 2020 年 6 月 21 日
I have two 3D scatter plots as shown below (upper and lower). I would like to connect each dot from lower scatter to each dot from the upper scatter in order.
Each scatter plots have 360000 points. I tried the following. It does work, but Matlab just hangs and takes too long.
It's not feasible to use even at 360 points. xl,yl,zl,xu,yu,zu are all column vectors with 360000 elements.
scatter3(xl, yl, zl,'b.'); %lower scatter
hold on;
scatter3(xu, yu, zu,'m.'); %upper scatter
hold on;
%connect dots
for s=1:length(xl)
plot3([xl(s), xu(s)], [yl(s), yu(s)], [zl(s), zu(s)], 'g-');
end
This is what I get from above. I will have to play with formatting to make it easier to see the shape, but this is what I would like to see.
I would like to know if there is a more efficient way to do this. Thank you.

回答 (1 件)

darova
darova 2020 年 6 月 21 日
Use plot3 instead of scatter3
  1 件のコメント
Jayman
Jayman 2020 年 6 月 21 日
plot3 doesn't seem to change anything. It's super slow still and not useable.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by