octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for datetick.m to improve ML compatibiity


From: Philip Nienhuis
Subject: Patch for datetick.m to improve ML compatibiity
Date: Wed, 20 Jan 2010 19:44:31 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 SeaMonkey/1.1.17

Hi,

While Matlab's datetick.m can handle plots without any actual argument supplied (and then defaults to "x-axis" and an optimal tick format for the tick range found), octave's datetick.m currently insists on having at least argument "FORM" specified.

A bit surprising as:

(1) After the test for presence of argument FORM, in subfunction __datetick__, that very argument is first set to [] (empty) around line 80;

(2) A bit further down the logic to determine optimal tick formats has been implemented already - and seems to be used too, still further down.

A simple patch to comment out the lines hampering ML compatibility is attached.
I tested it and it seems to work OK.
Hopefully the diff is in an acceptable format.

In the patch I've also added a line (currently commented out) to set the month format to "19" (i.e. dd/mm) rather than "6" (mm/dd) for in case datetick.m determines that the ticks should be represented by month values; European users might prefer this. Obviously it might be better to interrogate the system's language settings and then decide on this particular format but I wouldn't know how to do that - let alone how to do that in a platform-independent way :-(

Philip
38,40c38,40
<   if (nargin < 1)
<     print_usage ();
<   else
---
> #  if (nargin < 1)
> #    print_usage ();
> #  else
48c48
<   endif
---
> #  endif
107,113c107,113
<   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) && !isempty (form))
<     error ("datetick: expecting valid date format string");
<   endif
---
> #  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) && !isempty (form))
> #    error ("datetick: expecting valid date format string");
> #  endif
196c196,197
<       form = 6;
---
>       form = 6;                       # for US users
>       # form = 19;            # for European users  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]