No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Datetickzoom - automatically update dateticks

4.4 | 13 ratings Rate this file 39 Downloads (last 30 days) File Size: 2.48 KB File ID: #15029 Version: 1.0

Datetickzoom - automatically update dateticks



17 May 2007 (Updated )

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

| Watch this File

File Information

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


This file inspired Datetick With Zooming Panning And Subplots, Tlabel.M V2.6.1 (Sep 2009), Cbdate, and Datetickzoom For R2014b Onwards.

MATLAB release MATLAB 7.3 (R2006b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (18)
12 Feb 2017 Amitava Guha

Works like a charm. Very useful.

24 Dec 2016 bikefan

01 Dec 2016 Kristin Busa

Following up on latheefth's comment -- is there a way to include milliseconds in this function? Sub-seconds, there are no longer any ticks or tick labels shown. Thank you!

Comment only
05 Aug 2016 Amedeo

Amedeo (view profile)

02 Mar 2016 Davide

Davide (view profile)

26 Feb 2015 Nikolaos

Thank you!

14 Jun 2012 Fredrik

I agree on F Moisy comment from 2007. How do I use this witouth having to lose the date info when going down to hours and minutes?

07 Nov 2011 latheefth


I need to zoom it to milli sec, but it happens only till second.
Is there any way of doing it?

Comment only
11 Jun 2011 Nicolas

hold arrowkey -> matlab crashes

Comment only
21 Apr 2010 Karen

Karen (view profile)

13 Jan 2010 Marc Listmangof

15 Dec 2009 adam

adam (view profile)

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?

Comment only
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');


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.

24 May 2007 Dan Kominsky

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

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.

Comment only
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.

Contact us