How to create subplots in an animation

조회 수: 9 (최근 30일)
Nikolaos Zafirakis
Nikolaos Zafirakis 2019년 9월 20일
편집: Subhadeep Koley 2019년 10월 30일
I’m creating two graphs as animations. I want to take both and plot a single graph such that when the animation plays, they are side by side.
I tried options such as subplot and Tiledlayout(2,1) but they seen to not work for the 3D theatre plot.
Does anyone have any suggestions to fix this within my code.
%% Figure 1
L1 = plot(NaT, nan, 'b');
hold on
L2 = plot(NaT, nan, 'r');
L3 = plot(NaT, nan, 'g');
hold off
xdt = datetime(Time);
xlim([min(xdt) max(xdt)])
ylim([-180 180])
%% Figure 2
tp = theaterPlot('XLimit',[-2 2],'YLimit',[-2 2],'ZLimit',[-2 2]);
op1 = orientationPlotter(tp,'DisplayName','eulZYX','Marker','s','MarkerSize',20,'LocalAxesLength',2);
op2 = orientationPlotter(tp,'DisplayName','LVLH','Marker','s','MarkerSize',10,'LocalAxesLength',0.7);
for ind = 1 : size(xdt,1)
% Animation figure 1
cxdt = xdt(1:ind);
set(L1, 'XData', cxdt, 'YData', n(1:ind,1)));
set(L2, 'XData', cxdt, 'YData', n(1:ind,2)));
set(L3, 'XData', cxdt, 'YData', n(1:ind,3)));
drawnow update;
% Animation figure 2 3D
plotOrientation(op1,Rotation_Matrix1(:,:,ind))
plotOrientation(op2,Rotation_Matrix2(:,:,ind))
drawnow update;
pause (1)
end
  댓글 수: 4
Walter Roberson
Walter Roberson 2019년 9월 21일
Sorry I do not have that toolbox to experiment with.
Subhadeep Koley
Subhadeep Koley 2019년 10월 30일
편집: Subhadeep Koley 2019년 10월 30일
Nikolaos Zafirakis Your code snippet is not running in my end. Please, share a Minimal working example so that we can reproduce the same.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by