# HG changeset patch # User John W. Eaton # Date 1264016893 18000 # Node ID c2f1cdb59821b6a7e71b6a89c992d20dd316bcb0 # Parent 3778ea95adea2b2921f43fe10b7bd8b00fd82f22 datetick: make form argument optional diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-01-20 John W. Eaton + + * time/datetick.m: Make form arg optional. + From Philip Nienhuis . + 2010-01-20 David Bateman * plot/__go_draw_axes__.m: Correct an error in drawing of patch diff --git a/scripts/time/datetick.m b/scripts/time/datetick.m --- a/scripts/time/datetick.m +++ b/scripts/time/datetick.m @@ -17,7 +17,8 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} datetick (@var{form}) +## @deftypefn {Function File} {} datetick () +## @deftypefnx {Function File} {} datetick (@var{form}) ## @deftypefnx {Function File} {} datetick (@var{axis}, @var{form}) ## @deftypefnx {Function File} {} datetick (@dots{}, "keeplimits") ## @deftypefnx {Function File} {} datetick (@dots{}, "keepticks") @@ -35,17 +36,14 @@ [h, varargin, nargin] = __plt_get_axis_arg__ ("datetick", varargin{:}); - if (nargin < 1) - print_usage (); - else - oldh = gca (); - unwind_protect - axes (h); - __datetick__ (varargin{:}); - unwind_protect_cleanup - axes (oldh); - end_unwind_protect - endif + oldh = gca (); + unwind_protect + axes (h); + __datetick__ (varargin{:}); + unwind_protect_cleanup + axes (oldh); + end_unwind_protect + endfunction %!demo @@ -104,12 +102,14 @@ startdate = []; endif - if (isnumeric (form)) - if (! isscalar (form) || floor (form) != form || form < 0) - error ("datetick: expecting form argument to be a positive integer"); + if (! isempty (form)) + if (isnumeric (form)) + if (! isscalar (form) || floor (form) != form || form < 0) + error ("datetick: expecting form argument to be a positive integer"); + endif + elseif (! ischar (form)) + error ("datetick: expecting valid date format string"); endif - elseif (! ischar (form) && !isempty (form)) - error ("datetick: expecting valid date format string"); endif if (keeptick) @@ -192,6 +192,8 @@ ## days form = 8; elseif r < 365 + ## FIXME -- FORM should be 19 for European users who use dd/mm + ## instead of mm/dd. How can that be determined automatically? ## months form = 6; elseif r < 90*12