4.66667

4.7 | 6 ratings Rate this file 30 downloads (last 30 days) File Size: 2.48 KB File ID: #15029

Datetickzoom - automatically update dateticks

by Christophe Lauwerys

 

17 May 2007 (Updated 21 May 2007)

No BSD License  

Label axis with date ticks that automatically update when zooming or panning

Download Now | Watch this File

File Information
Description

DATETICKZOOM behaves completely identical to DATETICK, except that tick labels are automatically updated when zooming or panning.

Acknowledgements
This submission has inspired the following:
Datetick with zooming panning and subplots, tlabel.m v2.6.1 (Sep 2009)
MATLAB release MATLAB 7.3 (R2006b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
18 May 2007 F Moisy

Very useful, thanks!

One remark: it seems that datetickzoom uses the input argument dateform=0 by default, even if a second input argument is given. For instance, datetickzoom('x',1) should display labels in the form 'dd-mmm-yyyy' whatever the zoom. Instead, it automatically switches between different dateforms when zooming.

18 May 2007 Christophe Lauwerys

Concerning your remark: the switching between different dateforms is desired behavior since, in my opinion, the resolution of the ticks should increase when zooming in.

24 May 2007 Dan Kominsky

Very nice. This has been an annoying aspect of MatLab for some time. Thank you.

07 Jan 2008 Rajesh Rajaram

It is a very nice option to add to matlab. It works great on a single plot.

However I am not sure how I could use it when I also need to use the linkaxes option to link multiple subplots.

07 Mar 2008 Carlos Adrián Vargas Aguilera

Excellent job! Congratulations Christophe! I made a modification of your function and MATLAB's to put what is left by the ticks on the date-axis.

Rajesh: if time is in X-axis you can use
a = linkprop(h, {'XTick', 'XTickLabel', 'XLim', 'YLim'});
where h are your axes handles. And to link the label too:
b = linkprop(cell2mat(get(h,'XLabel')), 'String');

Cheers

09 Jun 2009 Florian

Hi Christophe,
I'm getting the error "One or more output arguments not assigned during call" in line 39 when using datetickzoom('x'). Any clue what I'm doing wrong?
Cheers

15 Dec 2009 adam  
13 Jan 2010 Marc Listmangof  
Please login to add a comment or rating.
Updates
21 May 2007

Supplying the DATEFORM argument fixes the dateform when zooming in or out.

Tag Activity for this File
Tag Applied By Date/Time
annotation Christophe Lauwerys 22 Oct 2008 09:13:04
customization Christophe Lauwerys 22 Oct 2008 09:13:04
date Christophe Lauwerys 22 Oct 2008 09:13:04
time Christophe Lauwerys 22 Oct 2008 09:13:04
zoom Christophe Lauwerys 22 Oct 2008 09:13:04
pan Christophe Lauwerys 22 Oct 2008 09:13:04
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com