Intelligent Dynamic Date Ticks
편집자 메모: This file was selected as MATLAB Central Pick of the Week
** Update: The archive now includes a new function setDateAxes which can be used like SET to set the properties of date axes (such as XLim) and have the tick labels update automatically. For example,
setDateAxes(gca, 'XLim', [datenum('July 1, 2008') datenum('August 1, 2008')])
** Update: DynamicDateTicks now supports an arbitrary day/month date formats. Use the third input argument to specify this: dynamicDateTicks([], [], 'dd/mm');
DYNAMICDATETICKS is a wrapper function around DATETICK which creates dynamic date tick labels for plots with dates on the X-axis. Features include:
* Smart ticks: Include year/month/day information on specific ticks as appropriate.
* Dynamic ticks: Ticks update as the plot is panned or zoomed
* Scaling ticks: Ticks change format as the timescale changes (from years to seconds).
* Support for multiple axes: Supports any combination of date and non-date axes as well as linked axes
* Date-friendly data tips: Dates displayed correctly on data cursors.
USAGE:
dynamicDateTicks()
makes the current axes a date axes with dynamic properties
dynamicDateTicks(axH)
makes all the axes handles in vector axH dynamic date axes
dynamicDateTicks(axH, 'linked')
additionally specifies that all the axes in axH are linked. This
option should be used in conjunction with LINKAXES.
dynamicDateTicks(axH, 'link', 'dd/mm')
additionally specifies the format of all ticks that include both
date and month information. The default value is 'mm/dd' but
any valid date string format can be specified. The first two
options may be empty [] if only specifying format.
EXAMPLES:
load integersignal
dates = datenum('July 1, 2008'):1/24:datenum('May 11, 2009 1:00 PM');
subplot(2,1,1), plot(dates, Signal1);
dynamicDateTicks
subplot(2,1,2), plot(dates, Signal4);
dynamicDateTicks([], [], 'dd/mm');
figure
ax1 = subplot(2,1,1); plot(dates, Signal1);
ax2 = subplot(2,1,2); plot(dates, Signal4);
linkaxes([ax1 ax2], 'x');
dynamicDateTicks([ax1 ax2], 'linked')
인용 양식
Ameya Deoras (2024). Intelligent Dynamic Date Ticks (https://www.mathworks.com/matlabcentral/fileexchange/27075-intelligent-dynamic-date-ticks), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- MATLAB > Graphics > Formatting and Annotation > Axes Appearance > Limits, Ticks, and Grids > Grid Lines, Tick Values, and Labels >
태그
도움
도움 준 파일: cbdate, MATLAB for R Users in Computational Finance, XivelyRead, Energy Trading & Risk Management with MATLAB Webinar Case Study, Electricity Load and Price Forecasting Webinar Case Study, Commodities Trading with MATLAB
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.5.0.1 | Updated license |
||
1.5.0.0 | Added a function setDateAxes to set properties of an axes with dates and update tick labels automatically |
||
1.4.0.0 | DynamicDateTicks now supports an arbitrary day/month date formats. Use the third input argument to specify this: dynamicDateTicks([], [], 'dd/mm'); |
||
1.0.0.0 |