No BSD License  

Highlights from
Datetickzoom - automatically update dateticks

4.71429

4.7 | 7 ratings Rate this file 37 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)

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

| 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 (11)
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  
21 Apr 2010 Karen  
11 Jun 2011 Nicolas

hold arrowkey -> matlab crashes

07 Nov 2011 latheefth

Hi,

I need to zoom it to milli sec, but it happens only till second.
datetickzoom('x','HH:MM:SS.FFF');
Is there any way of doing it?

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
pan Christophe Lauwerys 22 Oct 2008 09:13:04
zoom Christophe Lauwerys 22 Oct 2008 09:13:04
time Christophe Lauwerys 22 Oct 2008 09:13:04
datetick Jiro Doke 08 Apr 2010 20:01:24

Contact us at files@mathworks.com