How to plot 3d patch with Faces and vertices

I found the patch function, which allows me to plot patches given faces and vertices. As I am working with 3d data, my faces data is a 10670x3 matrix and the vertices are a 6136 x 3 matrix. When I try to display them with
patch('Faces', faces, 'Vertices', vertices)
It just plots the data projected to a 2d plane. How can I plot them in 3d?

 採用された回答

KSSV
KSSV 2021 年 7 月 15 日

0 投票

Try this:
patch('faces',faces,'vertices',vertices(:,1:2),'facevertexcdata',vertices(:,3),'facecolor','interp','edgecolor','none') ;
colorbar

2 件のコメント

Maximilian Krahn
Maximilian Krahn 2021 年 7 月 15 日
it does add color to display the 3d part, but I was looking for a 3d graph, where the poinst are plotted in 3d space
KSSV
KSSV 2021 年 7 月 15 日
There is edgecolor option....you change it to black or someother color. HAve a look on triplot, trimesh.

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

その他の回答 (2 件)

Maximilian Krahn
Maximilian Krahn 2021 年 7 月 15 日

1 投票

trimesh(faces, vertices(:,1),vertices(:,2),vertices(:,3))
solved it for me. Thanks KSSV

1 件のコメント

KSSV
KSSV 2021 年 7 月 15 日
Thanks is accepting the answer... who helped you...

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

Joerg Wensch
Joerg Wensch 2022 年 7 月 1 日

0 投票

Simply type view(3).

カテゴリ

製品

リリース

R2019a

質問済み:

2021 年 7 月 15 日

回答済み:

2022 年 7 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by