can I add multiple plots in a figure altogether in an inset as well?

조회 수: 8 (최근 30일)
Anil Kumar
Anil Kumar 2020년 2월 11일
답변: Chidvi Modala 2020년 12월 30일
An inset works like as follows,
axes('Position', [0.32 0.2 0.3 .3])
box on
plot(A1(:,3),A1(:,27),'b','LineWidth', 2);
set(gca,'FontWeight','bold','FontSize',12);
xlim([0 0.5]);
but shows only one plot after every complilation (adding hold on as well) for a varying parameter n (let's say). is it possibel to add all plots in a figure (compiled for different values of n and plotted using hold on) altogether for a certain range in x-axis in an inset as well?
Thanks,
Regards,
  댓글 수: 2
Andy
Andy 2020년 2월 11일
Where does parameter n come in?
For multiple plots onto a single axes, the loop would have to run after the axes have been initialised.
Anil Kumar
Anil Kumar 2020년 2월 11일
편집: Anil Kumar 2020년 2월 11일
varying n will give different sets of A(:,27). Thus, one can see those lines for each n in the main figure.
does the second line work sfor the inset?

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

답변 (1개)

Chidvi Modala
Chidvi Modala 2020년 12월 30일
You may need to move axes outside the loop to add multiple plots on a single figure. You may refer to the following example
axes('Position', [0.32 0.2 0.3 .3])
y = 1:10;
for n=1:4
y = n*x;
box on
plot(x,y,'b','LineWidth', 2);
hold on
set(gca,'FontWeight','bold','FontSize',12);
xlim([0 0.5]);
end

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by