datefig: figure handle class with automatically readjusting date ticks

버전 1.1.0.0 (2.45 KB) 작성자: Mark Mikofski
Handle class object that automatically resets date ticks after resize, zoom or pan.
다운로드 수: 493
업데이트 날짜: 2011/7/29

라이선스 보기

The MATLAB command datetick('x') will not automatically update date ticks if a figure is resized, zoomed or panned. datefig is a class definition that creates a MATLAB figure with ResizeFcn, zoom and pan callbacks that call datetick('x','keeplimits') for all axes with plots in a figure.

It can work with any plotting function, but will not show the date ticks until the figure is resized or the axes are zoomed/panned the first time. I am sure there is an axes-creation callback, but I could not find it easily. I will try to add it in a future version. Since it uses the MATLAB function datetick, it will not make sense unless the abscissa is a MATLAB serial date number.

There are overloaded plot, scatter and plotyy functions that put date ticks on the x-axis. If a datefig class object if specified as the first object, then it will plot in that figure, otherwise it will create a datefig object. The datefig class object is an optional second output. The overloaded methods are similar to the MATLAB functions. However, I'm not sure what it will do with AX as an argument. Also if the xdata is not a MATLAB serial date number then it will probably output garbage on the x-axis.

Example:
h = datefig;
subplot(2,1,1);
datefig.plot(h,datenum('1/1/2011'):datenum('12/31/2011'),1:365,'or',datenum('1/1/2011'):datenum('12/31/2011'),3650:-10:10,'-b');
subplot(2,1,2);
datefig.plotyy(h,datenum('1/1/2011'):datenum('12/31/2011'),1:365,datenum('1/1/2011'):datenum('12/31/2011'),3650:-10:10);

This is more generic alternate to using the MATLAB builtin timeseries class.

인용 양식

Mark Mikofski (2024). datefig: figure handle class with automatically readjusting date ticks (https://www.mathworks.com/matlabcentral/fileexchange/32359-datefig-figure-handle-class-with-automatically-readjusting-date-ticks), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2011a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Image Arithmetic에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.1.0.0

fix plot inputs, add overloaded method for scatter, add overloaded method for plotyy, fix errors with zoom/pan

1.0.0.0