Multiple 2d "contourf" surfaces in a 3d figure

Hi all,
I'd like to plot multiple (y,z) 2d surfaces (made with contourf function) at different position on x, in order to obtain 3d figure, exactly like this image:
Could you help me?
Thanks a lot

1 件のコメント

Philippe Corner
Philippe Corner 2019 年 9 月 2 日
Hi Enrico, did you solve your need?

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

回答 (1 件)

Aurele Turnes
Aurele Turnes 2014 年 8 月 6 日

0 投票

To recreate something like the figure attached, you can first create the planar surface in the 3D-plane using the surface function with appropriate (x,y,z) values and then set the CData properties of those surfaces to be your image slices. I am not certain that you can use contourf for this, but you can plot your images directly instead. For instance, if your images are contained in a 3d-matrix Z, where the third dimension indexes the slice number, you could try the following code:
% get the size of Z (P indicates the number of images to be plotted
[M,N,P] = size(Z);
figure;
hold on
for i=1:P
% Create a plane at x=i
h = surface(i*ones(1,M),1:N,repmat([M:-1:1],N,1),repmat([M:-1:1],N,1));
% set the color of the plane to be the image
h.CData = Z(:,:,i)';
% set some extra properties
h.CDataMapping = 'direct';
h.EdgeColor = 'none';
end
% set the viewing angle
view(3)

カテゴリ

ヘルプ センター および File ExchangeContour Plots についてさらに検索

タグ

質問済み:

2014 年 7 月 29 日

コメント済み:

2019 年 9 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by