multiple subplots in a figure
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Jarrod Rivituso
il 8 Mag 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 Commenti
Vedere anche
Categorie
Scopri di più su Subplots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!