0
clear all
depth1 = [0;2;3;4;5;6;8;10;12;14;16;18];
depth2 = [0;2;3;4;5;6;7;8;9;10;11;12];
depth3 = [0;4;6;8;10;12;14;16;18;20;22;24];
Depth = {depth1,depth2,depth3};
data1 = [0.8,0.797,0.796,0.795,0.795,0.795,0.797,0.798,0.8,0.802,0.803,0.802];
data2 = [0.764,0.752,0.743,0.745,0.746,0.736,0.710,0.656,0.584,0.574,0.577,0.601];
data3 = [0.760,0.750,0.745,0.714,0.593,0.354,0.257,0.272,0.295,0.327,0.368,0.379];
Data = {data1;data2;data3}';
coloring = {[0 0 0],[1 0 0],[0 0 1]}';
marking = {'+','o','s'};
for i = 1:length(Depth);
fh = figure(1);
plot(Depth{i},Data{i},'color',coloring{i},'Marker',marking{i});hold on;
legend;
set(fh,'color','white');
set(gca,'TickLength',[.01 .01],'TickDir','out','box','on','XMinorTick','on',...
'YMinorTick','on','FontName','Helvetica','FontSize', 14,...
'Fontweight','demi','XColor','k','YColor','k');
end
此示例顯示了一個繪圖,其中每個測量的深度變化的不同深度處測量了三個不同變量。我想知道是否可以更改x軸,以便顯示的範圍從0到1不等,分別代表最小和最大深度。這可能嗎?更改繪圖中的x軸範圍
,我已經使用當前的方法是:
newDepth = cellfun(@(x)linspace(0,1,length(x)),Depth,'un',0);
,然後繪製數據對這種新的深度向量。
for i = 1:length(Depth);
fh = figure(1);
plot(newDepth{i},Data{i},'color',coloring{i},'Marker',marking{i});hold on;
legend;
set(fh,'color','white');
set(gca,'TickLength',[.01 .01],'TickDir','out','box','on','XMinorTick','on',...
'YMinorTick','on','FontName','Helvetica','FontSize', 14,...
'Fontweight','demi','XColor','k','YColor','k');
end
有沒有更好的方法?
很好用。現在一切都好了。謝謝你的幫助。 – Emma 2012-04-27 16:40:24