通过删除一些空白区域来编辑Matlab中的一些数字

时间:2013-04-27 05:38:23

标签: matlab matlab-figure

我在Matlab中有4个数字。问题是有一些空白但我不知道如何从数字中删除它们。在下图中,我想删除一些空格。此外,我想调整颜色条以开始和结束图像帧。所以,如果有人能帮助我。 以下是从下面的脚本中显示的4个数字,我编辑了它们来解释我想要的所需数字。 1st 2nd 3rd 4th 这是我使用的代码:

load('D:\Deakin\My papers\Hussein\MatFiles\k640_Sensor_Lights_On_2000mm-pgms.mat','stats');
ax(1)=subplot(1,2,1);imagesc(stats.std,[0 18]);colormap(jet(256)); title('(a)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+550 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_2000mm-pgms.mat','stats');
ax(2)=subplot(1,2,2);imagesc(stats.std,[0 18]);colormap(jet(256)); title('(b)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+550 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
h=colorbar('SouthOutside');
set(h, 'Position', [.1 .05 .8150 .05]);
for i=1:2
pos=get(ax(i), 'Position');
set(ax(i), 'Position', [pos(1) 0.1+pos(2) pos(3) 0.8*pos(4)]);

end;
set(findobj('type','axes'),'FontSize',20);
set(gcf,'units','normalized','outerposition',[0 0 1 1]);

figure();

load('D:\Deakin\My papers\Hussein\MatFiles\k640_Sensor_Lights_On_0500mm-pgms.mat','stats');
ax(1)=subplot(2,5,1);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(a)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\k640_Sensor_Lights_On_1000mm-pgms.mat','stats');
ax(2)=subplot(2,5,2);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(b)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\k640_Sensor_Lights_On_1500mm-pgms.mat','stats');
ax(3)=subplot(2,5,3);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(c)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\k640_Sensor_Lights_On_2000mm-pgms.mat','stats');
ax(4)=subplot(2,5,4);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(d)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\k640_Sensor_Lights_On_2500mm-pgms.mat','stats');
ax(5)=subplot(2,5,5);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(e)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_0500mm-pgms.mat','stats');
ax(6)=subplot(2,5,6);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(f)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_1000mm-pgms.mat','stats');
ax(7)=subplot(2,5,7);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(g)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_1500mm-pgms.mat','stats');
ax(8)=subplot(2,5,8);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(h)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_2000mm-pgms.mat','stats');
ax(9)=subplot(2,5,9);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(i)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_2500mm-pgms.mat','stats');
ax(10)=subplot(2,5,10);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(j)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
h=colorbar('SouthOutside');
set(h, 'Position', [.1 .05 .8150 .05]);
for i=1:10
pos=get(ax(i), 'Position');
set(ax(i), 'Position', [pos(1) 0.1+pos(2) pos(3) pos(4)]);
end;
set(findobj('type','axes'),'FontSize',20);
set(gcf,'units','normalized','outerposition',[0 0 1 1]);
figure();

load('D:\Deakin\My papers\Hussein\MatFiles\k640_Sensor_Heater_On_1000mm-pgms.mat','stats');
ax(1)=subplot(2,2,1);imagesc(stats.entropy,[0 4]);colormap(jet(256)); title('(a)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\k640_Sensor_Lights_On_1000mm-pgms.mat','stats');
ax(2)=subplot(2,2,2);imagesc(stats.entropy,[0 4]);colormap(jet(256)); title('(b)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Heater_On_1000mm-pgms.mat','stats');
ax(3)=subplot(2,2,3);imagesc(stats.entropy,[0 4]);colormap(jet(256)); title('(c)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_1000mm-pgms.mat','stats');
ax(4)=subplot(2,2,4);imagesc(stats.entropy,[0 4]);colormap(jet(256)); title('(d)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+640 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
h=colorbar('SouthOutside');
set(h,'XTick',0:4);
set(h, 'Position', [.1 .05 .8150 .05]);
for i=1:4
pos=get(ax(i), 'Position');
set(ax(i), 'Position', [pos(1) 0.1+pos(2) pos(3) 0.8*pos(4)]);
end;
set(findobj('type','axes'),'FontSize',20);
set(gcf,'units','normalized','outerposition',[0 0 1 1]);
figure();

load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_2500mm_with_interference_distance_1600-pgms.mat','stats');
ax(1)=subplot(1,3,1);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(a)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+550 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_2500mm_with_interference_distance_1350-pgms.mat','stats');
ax(2)=subplot(1,3,2);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(b)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+550 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
load('D:\Deakin\My papers\Hussein\MatFiles\x640_Sensor_Lights_On_2500mm_with_interference_distance_1100-pgms.mat','stats');
ax(3)=subplot(1,3,3);imagesc(stats.nlvls,[0 16]);colormap(jet(256)); title('(c)');
set(findobj('type','text'),'FontSize',20);
h=get(gca,'Title');
P = get(h,'Position');
set(h,'Position',[P(1) P(2)+550 P(3)],'FontSize',20);
set(gca,'FontSize',20);
set(gca,'DataAspectRatio',[1 1 1]);
axis off;
h=colorbar('SouthOutside');
set(h, 'Position', [.1 .05 .8150 .05]);
for i=1:3
pos=get(ax(i), 'Position');
set(ax(i), 'Position', [pos(1) 0.1+pos(2) pos(3) 0.8*pos(4)]);
end;
set(findobj('type','axes'),'FontSize',20);
set(gcf,'units','normalized','outerposition',[0 0 1 1]);
figure();

1 个答案:

答案 0 :(得分:1)

我知道两种方法:

  • subplot('position',[left bottom width height])函数允许将子图定位在标准化坐标系中的任何位置。

  • 将数字转换为*.eps格式,并在某些graphic software中手动删除空格。如果您只是需要为出版目的准备一个数字,这是最好的。