Mercurial > hg > octave-terminal
changeset 10151:c2f1cdb59821
datetick: make form argument optional
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Jan 2010 14:48:13 -0500 |
parents | 3778ea95adea |
children | b6b65e71049b |
files | scripts/ChangeLog scripts/time/datetick.m |
diffstat | 2 files changed, 24 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-01-20 John W. Eaton <jwe@octave.org> + + * time/datetick.m: Make form arg optional. + From Philip Nienhuis <pr.nienhuis@hccnet.nl>. + 2010-01-20 David Bateman <dbateman@free.fr> * plot/__go_draw_axes__.m: Correct an error in drawing of patch
--- a/scripts/time/datetick.m +++ b/scripts/time/datetick.m @@ -17,7 +17,8 @@ ## <http://www.gnu.org/licenses/>. ## -*- 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