豆粑粑 matlab subplot 多图大小设置
自己的问题,subplot总是出问题。通过 ax设置,可行,
多个子图,每个子图比subplot的默认值大。可以自己定义。
clear all
clc
clf
sbp_width=0.8;
sbp_heig=0.85;
n_row = 4;
n_col = 6;
=fun_mm_subplot_pos(n_row,n_col,sbp_width,sbp_heig);
h=figure(1)
set(h, 'Position', );
=peaks(30);
caxis_mm=[-5 30];
for i=1:n_row*n_col
ax=axes('position',out_pos(i,:));
surf(x,y,z+i,'edgecolor','none')
caxis(caxis_mm)
axis tight
view(0,90)
hold on
text(,,,mat2str(i),'fontsize',20)
end
colormap(jet)
function =fun_mm_subplot_pos(n_row,n_col,sbp_width,sbp_heig);
% subplot pos
% input : -----------------
% n_row : number of row
% n_col : number of column
% sbp_width : subplot width0-1
% sbp_heig: subplot height 0-1
% output : ----------------
% out_pos
%
%
% sbp_width=0.8;
% sbp_heig=0.85;
% n_row = 4;
% n_col = 6;
% =fun_mm_subplot_pos(n_row,n_col,sbp_width,sbp_heig);
% h=figure(1)
% set(h, 'Position', );
% =peaks(30);
% caxis_mm=[-5 30];
% for i=1:n_row*n_col
% ax=axes('position',out_pos(i,:));
% surf(x,y,z+i,'edgecolor','none')
% caxis(caxis_mm)
% view(0,90)
% hold on
% text(,,,mat2str(i),'fontsize',20)
% end
for i=1:n_row*n_col
k1=ceil(i/n_col);
k2=i-(k1-1)*n_col;
out_pos(i,:)=[(1-sbp_width)/n_col/2 + (k2-1)/n_col,...
(1-sbp_heig )/n_row/2 + (n_row-k1)/n_row, ...
sbp_width/n_col,...
sbp_heig/n_row];
end
页:
[1]