Four different figures of same plot - 3D plot, XZ, XY, YZ Plot

조회 수: 7 (최근 30일)
Nick S
Nick S 2016년 3월 4일
답변: Walter Roberson 2016년 3월 4일
Hi
I have a 3D plot and want to see all of the 2D views as separate figures. I know how to use the view command to see what I want (i.e. view([0 90])), but it just updates the current figure. I'd like to have four different figures of the same plot: one 3d, one a 2D XY view, one a 2D XZ view, and one a 2D YZ view. How can I open up new figures for each view?
Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 4일
You cannot have multiple figures with the same plot. Each plot can have only one parent. You can copyobj() the graphics into multiple figures and you can call view() on each of the resulting new axes, specifying the axes handle as the first argument.
For example,
curax = gca(); %what we are copying
views = [0 90 0; 90 0 0; 0 0 90];
titles = {'xy view', 'yz view', 'xz view'}; %you will need to fix these!
for extra_view = 1 : size(views,1)
newfig = figure();
newax = copyobj(curax, newfig);
view(newax, views(extra_view,:));
titles(newax, titles{extra_view});
set(newfig, 'Name', titles{extra_view});
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by