Adding subplots to secondary axis
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Markus Toivonen
am 28 Mai 2018
Beantwortet: Ameer Hamza
am 28 Mai 2018
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?
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 28 Mai 2018
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!