multiple subplots in a figure
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to plot multiple subplots in a single figure. But some weired problem exists and some subplots are deleted !! or maybe there exists other methods to add multiple subplots.
nx=20; ny=10;
ngrids=nx*ny;
figure;
for i=1:ngrids
y=ceil((i)/nx);
x=i-(y-1)*nx;
subplot(nx,ny,i);
axis square;
set(gca,'xtick',[],'ytick',[],'Position', [((-1/nx)+x/nx) ((1-1/ny)-(y-1)/ny) (1/nx) (1/ny)]);
text(.5,.5,int2str(i),'FontSize',9,'HorizontalAlignment','center')
pause(0.001);
end
0 Kommentare
Antworten (1)
Jarrod Rivituso
am 8 Mai 2011
Similar question:
Main point there -> use "axes" instead of "subplot" if you are going to modify the position manually anyway.
nx=20;
ny=10;
ngrids=nx*ny;
figure;
for i=1:ngrids
y=ceil((i)/nx);
x=i-(y-1)*nx;
axes
axis square;
set(gca,'xtick',[],'ytick',[],'Position', [((-1/nx)+x/nx) ((1-1/ny)-(y-1)/ny) (1/nx) (1/ny)]);
text(.5,.5,int2str(i),'FontSize',9,'HorizontalAlignment','center')
pause(0.001);
end
0 Kommentare
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!