Plotting time in x-axis
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm trying to plot 2 hydrographs for comparison but I'm having problems with changing the time in the x axis to the format of Hour in the day like "DD HH:MM". The code I'm using to plot is shown below. I've tried datetick with no luck. Thank you for your help!
plot(dateus(z1:z2),Qusgs(z1:z2),'m');
hold on
plot(ns,Q,'g');
hold off
legend('USGS','SWMM')
title('Change in Width for Accotink Watershed Using Dulles Precipitation Data for Sept29-Oct2, 2010 Event')
xlabel('Time')
ylabel('Q')
saveas(h,sprintf('Width%d.png',x));
3 个评论
dpb
2013-11-7
编辑:dpb
2013-11-8
OK, so still what/how does the dateus value relate to real time? You'll need to translate that to Matlab datenum as noted earlier to use builtin Matlab facilities. Otherwise, you can manually make labels but that's the harder solution it would seem.
ADDENDUM:
Matlab thinks 733779 is 6Jan2009 if assume a datenum -- is this correct? Excel thinks its 6Jan3909 owing to the difference in start dates.
Whatever it is, that's the basic starting point to get the offset from the Matlab datenum origin to match up to what these represent if they're not Matlab-consistent as is. If they are, then plot with them on the x-axis and as noted, used datetick to format the axis as desired.
回答(1 个)
dpb
2013-11-7
You need the x-axis variables to be in Matlab serial datenums and then used datetick to format.
doc datenum % and friends
doc datetick
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!