2017-07-27 315 views
0

我繪製了4個子圖,出於某種原因,圖中沒有出現前2個子圖的x軸刻度標籤(x軸標籤應該是小時從日期時間開始)。MATLAB不在子圖上顯示x刻度標籤

我的代碼是:

figure 
subplot(2,4,1) 
plot(dateval,Height,'b','LineWidth',1) 
datetick('x','HH:MM') %change the axis to time format 
xlim([736886.619552373 736886.692032847]) %Limits 
set(gca, 'FontName', 'Bookman','FontSize',7); 
xlabel('Time','FontSize',7,'FontWeight','normal','Color','k','FontName','Bookman') 
ylabel('GPS Height $[m]$','FontSize',7,'FontWeight','normal','Color','k','FontName','Bookman','Interpreter','latex') 


subplot(2,4,2) 
plot(dateval,Pressure,'b','LineWidth',1) 
datetick('x','HH:MM') %change the axis to time format 
xlim([736886.619552373 736886.692032847]) %Limits 
xlabel('Time','FontSize',7,'FontWeight','normal','Color','k','FontName','Bookman') 
ylabel('Sensor Pressure $[mb]$','FontSize',7,'FontWeight','normal','Color','k','FontName','Bookman','Interpreter','latex') 
set(gca, 'FontName', 'Bookman','FontSize',7); 


subplot(2,4,[5 6]) 
scatter(Pressure,Height,3,'b','*'); %Number is the size of dots 
h=lsline; 
set(h,'color','r','LineWidth',2); 
R=corrcoef([Pressure,Height]); 
Fit = polyfit(Pressure,Height,1); 
ylabel('GPS Height $$[m]$$','FontSize',7,'FontWeight','normal','Color','k','FontName','Bookman','Interpreter','latex'); 
xlabel('Pressure $[mb]$','FontSize',7,'FontWeight','normal','Color','k','FontName','Bookman','Interpreter','latex'); 
xlim([1003 1015]) 
ylim([0 90]) 
set(gca, 'FontName', 'Bookman','FontSize',7); 
box on 

subplot(2,4,[3,4,7,8]) 
image(imread('TripMap.jpg')); 
set(gca,'xtick',[]) 
set(gca,'xticklabel',[]) 
set(gca,'ytick',[]) 
set(gca,'yticklabel',[]) 

下圖:

enter image description here

我缺少什麼?

謝謝!

+0

你可以添加你的身影? – Flynn

+0

是 - 我編輯了我的帖子 – ValientProcess

+0

如果你分別繪製這兩個圖表,它是否繪製?如果它看起來正確,那麼你可能只需要格式化你的刻度。否則,有可能是你的xlim發生了一些事情。 – Flynn

回答

1

試圖改變這兩條線的順序:

datetick('x','HH:MM') %change the axis to time format 
xlim([736886.619552373 736886.692032847]) %Limits 

要:

xlim([736886.619552373 736886.692032847]) %Limits 
datetick('x','HH:MM') %change the axis to time format 
+0

它適用於蜱!但現在xlim命令不起作用 – ValientProcess

+0

更改爲datetick('x','HH:MM','keeplimits') – Flynn

+0

它在我執行此操作後運行並在「set(gca ..」)行後移動兩行! 謝謝 – ValientProcess