How to put only the day number on the X-axis while 24 values being plotted for each day?
2 views (last 30 days)
I have hourly data for each day for a month( size 31x24)and need to plot them in a away only the day number appears on the X-axis for corresponding 24 values being plotted. In other words, X-axis should show only 1,2,3, ...31, for 24 values of each day. Please help me with that.
dpb on 23 Jul 2017
Edited: dpb on 24 Jul 2017
Did you convert to datetime as I suggested in the earlier thread? If so, if you have late release (R2016b?) use the ruler format property to set the format that you wish <plot-dates-and-durations>
ADDENDUM OK, see if I did get the interpretation right now or not... :)
Again starting from the previous fixup of the original data in the datetime array...
plot(da,randn(size(da))) % plot against absolute time
% set x-axis limits to beginning of first day, next day after end of data (*)
% space ticks on daily interval from first to last of xlim range
This yields the following--
Alternatively, if just want the day numbers but not the month label then adding
% set the time format to display numerical days only...
As noted earlier, I've R2014b so the datetime ruler object isn't available, hence the use of datetick. You can use whichever of the tools are in the release you have but the basic idea (I think) should now be clear?
(*) There also likely won't be enough room for 300/24 --> 12+ ticks on a daily basis but try it and see