Code covered by the BSD License  

Highlights from
Zoom Adaptive Date Ticks

4.75

4.8 | 8 ratings Rate this file 19 Downloads (last 30 days) File Size: 1.6 KB File ID: #15342

Zoom Adaptive Date Ticks

by Andreas Krahnke

 

18 Jun 2007 (Updated 11 Jul 2007)

Make date ticks adapt to zooming

Editor's Notes:

This was a File Exchange Pick of the Week

| Watch this File

File Information
Description

% ZOOMADAPTIVEDATETICKS - Make date ticks adapt to zooming
%
% zoomAdaptiveDateTicks('on')
% Turns on the automatic adaptation of date ticks
% to user zooming for the current figure window
%
% zoomAdaptiveDateTicks('off')
% Turns off the automatic adaptation of date ticks
% to user zooming for the current figure window
%
% zoomAdaptiveDateTicks('demo')
% Opens a demo figure window to play with

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
20 Jun 2007 Erik Stalberg

Thanks Andreas! This tool is very useful and the code is very well written.
Erik Stalberg

07 Jul 2007 Les Beckham

This is nice and should prove useful.

The 'demo' feature uses the 'today' function which, apparently, only ships with the Financial toolbox. If you replace the line
    dates = today - linspace(1169,0,15000)';
with
    dates = floor(now) - linspace(1169,0,15000)';

it will work without the 'today' function.

11 Jul 2007 Jeremy Almeter

This function is very useful. It is short, simple, and makes the graphs easier to read.

02 Aug 2007 Richard Stephens

This is just what I've been looking for!
Thanks.

26 Jul 2010 Hans Martin Aannestad

Thank you so much for this! I have struggled with 'manual mode' and updating date vectors for ages, this is such a simple and elegant solution.

04 Apr 2011 Ryan Moffet  
13 Jun 2011 Stijn de Waele

Useful script! For multiple axes with linked time axis, I have modified the code to:
function adaptiveDateTicks(figureHandle,eventObjectHandle)
% Resetting x axis to automatic tick mark generation
ax=findall(figureHandle,'type','axes');
arrayfun(@(x) set(x,'XTickMode','auto'),ax)
% using automaticallly generate date ticks
arrayfun(@(x) datetick(x,'x','keeplimits'),ax)

27 Sep 2011 lflorhid

Very, very useful.. thank you very much

Please login to add a comment or rating.
Updates
11 Jul 2007

Changed the 'demo' feature to not use the 'today' function which only ships with the Financial toolbox but the 'now' function

Tag Activity for this File
Tag Applied By Date/Time
annotation Andreas Krahnke 22 Oct 2008 09:16:20
customization Andreas Krahnke 22 Oct 2008 09:16:20
date Andreas Krahnke 22 Oct 2008 09:16:20
zoom Andreas Krahnke 22 Oct 2008 09:16:20
automatically Andreas Krahnke 22 Oct 2008 09:16:20
rescale Andreas Krahnke 22 Oct 2008 09:16:20
potw Robert Bemis 04 Jun 2009 09:54:17
datetick Jiro Doke 08 Apr 2010 23:05:24
pick of the week Jiro Doke 11 Feb 2011 20:15:33

Contact us at files@mathworks.com