Adding subplots to secondary axis

조회 수: 2 (최근 30일)
Markus Toivonen
Markus Toivonen 2018년 5월 28일
답변: Ameer Hamza 2018년 5월 28일
Is it possible to add subplots to a secondary axis in a figure?
x1 = 1:5;
x2 = 5:10;
x3 = 10:15;
y1 = exp(x1);
y2 = exp(x2);
y3 = exp(x3);
descr = {'Basic text'
};
fig = figure('Name','','units','normalized','pos',[0 0 1 1]);
ax1 = axes('Position',[0.1 .5 0.5 0.5],'Visible','off'); % axis for the text
text(.025,0.6,descr)
ax2 = axes('Position',[.3 .1 .6 .8]); % axis for the big plot
plot(x1,y1)
ax3 = axes('Position',[0 0 0.26 0.5]); % axis for the subplots
subplot(2,1,1)
plot(x2,y2)
subplot(2,1,2)
plot(x3,y3)
Now it just overwrites every command before the subplot line. What am I doing wrong or is this even possible?

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 28일
subplot() command itself creates an axis. You cannot use it to draw axis on a predefined axis. If you want to create small axis on your predefined position, you should do something like this using axes() instead of subplot
ax3 = axes('Position',[0 0 0.26 0.22]);
ax4 = axes('Position',[0 0.28 0.26 0.5]);

추가 답변 (0개)

카테고리

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

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by