How to align my plots correctly with the x-axis?
    9 views (last 30 days)
  
       Show older comments
    
First, I apologize for the title of the question. Essentially, when I plot two series individually (see P7.png and P25.png) and compare them with the dashed lines at 4, 7, 9.75 and 11 degrees (where the peaks should occur) they do pretty well. As soon as I try to plot them on the same graph they seem to be shifted and no longer align (see P7and25.png). This gets worse the more dataset that I have. I have included the data as test.mat. Thank you in advance for your help. 
P7.png:

P25.png:

P7and25.png:

load(test.mat)
h = cell(1,length(d));
cmap = jet(m);
figure
%xlim([-5 20])
hold all
 for k=1:m 
    %Apply 50 degree elevation cutoff
    idx2 = find(All_oelev(:,k) > 50 & All_oelev(:,k) < 140); % indices to plot of All_oelev
    plot(xi2(k,idx2),VTEC2(idx2,k), 'Color', cmap(k, :))%, '--g','linewidth',2)% Fig5
    sz=size(idx2);
    idx2 = NaN(sz);
    %h{k} =sprintf('aircraft at %3.4f degrees latitude', parnam{1,k}.data(1,1)) ;
    end
     plot([4 4], [0 max(max(AllTEC))],'--k','LineWidth',2);
    plot([7 7], [0 max(max(AllTEC))],'--k','LineWidth',2);
    plot([9.75 9.75], [0 max(max(AllTEC))],'--k','LineWidth',2);
    plot([11 11], [0 max(max(AllTEC))],'--k','LineWidth',2);
%ylim([-0.4 0.8])
xlabel('Latitude (Degree)','fontsize',24, 'fontweight','bold'); 
ylabel('Total Electron Content (TECu = 10^{16} electrons/m^2)','fontsize',24, 'fontweight','bold')
 %legend(h)
 hold off
Best regards,
Alex
2 Comments
  Jakob B. Nielsen
      
 on 17 Feb 2020
				How do you generate your first two (individual) plots? Looking at your data, the peak that you want to have at 11 degrees is at 11,36 so I don't understand how you manage to make them align in your first plot. 
Answers (0)
See Also
Categories
				Find more on Graphics Object Properties in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
