4.5

4.5 | 2 ratings Rate this file 4 Downloads (last 30 days) File Size: 13.22 KB File ID: #285

dateNtick.m

by Peter Torrione

 

12 Jul 1999

A function which allows multi-line dates to be displayed.

| Watch this File

File Information
Description

A function which allows multi-line dates to be displayed. (uses 'datetick')
  
Tested under MATLAB 5.3.

Acknowledgements
This submission has inspired the following:
dateNtick
MATLAB release MATLAB 5.3 (R11)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
05 Sep 2008 Kevin Delaney

Much needed! Thanks!

29 Sep 2008 Kevin Delaney

Peter:
   Many thanks for providing this much-needed routine. I use it all the time & it makes plots much more professional-looking.

   I have two suggestions for small improvements:

   1) Within the "if write_another_line" section, change to this to automatically sense if y-axes are reversed:

  % Allow for reverse-direction y-axes.
  offset = .25 * abs(ylims(2)-ylims(1)) / yaxlinch;
                
  if strcmp(get(gca, 'YDir'), 'normal')
    yy = ylims(1) - offset;
  else
    yy = ylims(2) + offset;
  end

   2) Add a 'Tag' to the "additional" text line, so that it is erased when dateNtick is called a second time on the same plot:

  > Change the creation of text to this:
  text(xt-xlen, ypos, labels, ...
       'Color', get(gca, 'XColor'), ...
       'FontSize', get(gca, 'FontSize'), ...
       'Tag', 'dateNtick_labels');

  > Add this to beginning of function.
  % Get rid of old labels.
  delete(findobj('Parent', gca, ...
         'Tag', 'dateNtick_labels'));
   

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
annotation Peter Torrione 22 Oct 2008 06:35:27
customization Peter Torrione 22 Oct 2008 06:35:27
function Peter Torrione 22 Oct 2008 06:35:27
multiline dates Peter Torrione 22 Oct 2008 06:35:27
graphics Peter Torrione 22 Oct 2008 06:35:27
plot annotation Peter Torrione 22 Oct 2008 06:35:27

Contact us at files@mathworks.com