Adding subplots to secondary axis

1 回表示 (過去 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 Center および File ExchangeSubplots についてさらに検索

製品


リリース

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by