Convert serial-date axis labels to calendar-date axis labels
dateaxis(Tickaxis,DateForm,StartDate)
| (Optional) Determines which axis tick labels—x, y,
or z—to replace. Enter as a character
vector. Default |
| (Optional) Specifies which date format to use. Enter as an integer from |
| (Optional) Assigns the date to the first axis tick value,
specified as a serial date number, date character vector, or datetime
array. The tick values are treated as serial date numbers. The default |
dateaxis(Tickaxis,DateForm,StartDate)
replaces
axis tick labels with date labels on a graphic figure.
See the MATLAB® set
command
for information on modifying the axis tick values and other axis parameters.
DateForm | Format | Description |
---|---|---|
|
| day-month-year hour:minute:second |
|
| day-month-year |
|
| month/day/year |
|
| month, three letters |
|
| month, single letter |
|
| month |
|
| month/day |
|
| day of month |
|
| day of week, three letters |
|
| day of week, single letter |
|
| year, four digits |
|
| year, two digits |
|
| month year |
|
| hour:minute:second |
|
| hour:minute:second AM or PM |
|
| hour:minute |
|
| hour:minute AM or PM |
|
| year month day |
dateaxis('x') or dateaxis
converts the x-axis labels to an automatically determined date format.
dateaxis('y', 6)
converts the y-axis labels to the month/day format.
dateaxis('x', 2, '03-Mar-1999')
or
dateaxis('x', 2, datetime('03-Mar-1999'))
converts the x-axis labels to the month/day/year format. The minimum x-tick value is treated as March 3, 1999.