How to align my plots correctly with the x-axis?
10 次查看(过去 30 天)
显示 更早的评论
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/271743/image.png)
P25.png:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/271744/image.png)
P7and25.png:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/271745/image.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 个评论
Jakob B. Nielsen
2020-2-17
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Earth, Ocean, and Atmospheric Sciences 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!