Adding subplots to secondary axis

2 次查看(过去 30 天)
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 个)

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by