方法很简单,只要将papersize固定就行了:set(gcf,\'unit\',\'normalized\',\'position\',[0.2 0.3 0.4 0.4])
如下面的程序用来绘制2800km处的S波层析成像,旋转以能够在各个视角看到其变化。
filename= \'map.2800km.xyz\';
a=dlmread(filename);
lat0=-90:90;
long0=-180:179;
dv=zeros(length(lat0),length(long0));
for i1=1:length(long0)
dv(1,i1)=a(end,3);
temp3=(i1-1)*(length(lat0)-2)+1;
temp4=i1*(length(lat0)-2);
dv(2:(length(lat0)-1),i1)=a(temp3:temp4,3);
dv(length(lat0),i1)=a(end-1,3);
end
% % plotting
figure
set(gcf,\'unit\',\'normalized\',\'position\',[0.2 0.3 0.4 0.4])
sphere;
h = findobj(gcf, \'Type\', \'surface\');
set(h, \'CData\', dv, \'FaceColor\', \'texturemap\')
axis equal;
ylabel(\'long = -180\')
axis image off
c1=colormap;
set(gcf,\'colormap\',flipud(c1));
colorbar
aviobj=avifile([filename(1:end-3),\'.avi\'],\'fps\',2);
for i1=0:15:360
view(i1,0);
drawnow
MOV=getframe(gcf);
aviobj=addframe(aviobj,MOV);
end
aviobj=close(aviobj)