Søren Hauberg wrote:
> tir, 19 01 2010 kl. 20:26 +0100, skrev Philip Nienhuis:
>> >> It also invokes a stray gnuplot if called with too many arguments.
>> >
>> > I don't quite understand. Could you provide an example?
>>
>> If I call dateaxis with -say- 4 arguments, I get an extra empty gnuplot
>> window. IIRC that's what the "return" statement I added around line 72
>> aims to fix.
>>
>> (Unless it is intended behaviour to continue execution after a "usage"
>> warning.)
>
> 'print_usage' raises an error (not a warning), so the function is
> interrupted after the call to 'print_usage'. So, the 'return' statement
> is never executed.
...but doesn't do harm. For unexperienced octave programmers like me
that statement may serve as an illustration of program flow.
But thanks for your clarification.
> The reason why you are seeing a gnuplot window is the call to 'gca'.
> I've moved this call after the input checking, which avoids the issue.
>
>> >> The bug is that argument "startdate" is actually ignored.
>> >
>> > I don't know the code very well, so I can't really comment on this. I
>> > see your change includes
>> >
>> > ticks = get (h, [ax "tick"]);
>> > - ticks = ticks - ticks(1) + startdate;
>> > + ## Added by PRN oct 2009
>> > + if (~isempty(startdate)) + ticks = ticks -
>> ticks(1) + startdate;
>> > + endif
>> >
>> > I don't, however, see what this does or how it relates your comment
>> > about 'startdate' being ignored. In the case where 'startdate' is empty
>> > the current code is the same as doing
>> >
>> > ticks = ticks - ticks (1);
>> >
>> > Isn't that okay?
>>
>> (Hmmmm... for me it's also quite a while back....)
>>
>> ...but here it is. No it's not okay, at least on my octave-3.2.3_MingW:
>> (for clarity I renamed the original dateaxis.m to dateaxis_old.m)
>>
>> I made a plot with with x-axis values ranging from 713396 to 719786.
>> Then, invoking dateaxis_old ('x'):
>>
>> ----------------------------------
>> octave-3.2.3.exe: #15> dateaxis_old ('x')
>> error: operator +: nonconformant arguments (op1 is 1x8, op2 is 0x0)
>> error: called from:
>> error:
>> C:\Programs\Octave\3.2.3_gcc4.4.0\share\octave\packages\financial-0.3.2\dateaxis_old.m
>> at line 94, column 9
>> ----------------------------------
>>
>> So octave doesn't accept an empty value for startdate in the statement
>
> Ah, sorry about that. I added an 'isempty' check around the line
> question. As I don't know what this code is supposed to do, it would be
> great if somebody could verify that this is the right thing to do.
In the original message, dated Oct 30th, I already cc'd Bill Denney.
I've never heard back from him, nor did you I suppose, so perhaps his
email address is no longer valid. His last posting to any octave ML was
late May 2009 (according to Nabble).
Anyway I did check the corrected code last October and it worked OK. It
is supposed to shift the start date (left most tick) *if* a startdate
has been specified.
(I wouldn't know why there's no enddate too, but that was not the issue.)
On a related note, a week or so ago I posted a bug message about
datetick.m (in core octave) in the bug-octave ML. While experimenting
with that I found that dateaxis.m doesn't properly treat dates in ranges
shorter than about 1 year:
Preliminary setup:
octave-3.2.3.exe: #1 > fff = rand (2, 51);
octave-3.2.3.exe: #3 > fff(1,:) = [0.0 : 0.02 : 1.0];
octave-3.2.3.exe: #4 > plot (fff(1,:), fff(2,:))
Then:
##- range [0 -1]:
octave-3.2.3.exe: #5 > dateaxis
error: subscript indices must be either positive integers or logicals.
error: called from:
error:
C:\Programs\Octave\3.2.3_gcc4.4.0\share\octave\3.2.3\m\time\datestr.m at
line 258, column 9
error:
C:\Programs\Octave\3.2.3_gcc4.4.0\share\octave\packages\financial-0.3.2\dateaxis.m
at line 104, column 9
##- range [0 - 200]:
octave-3.2.3.exe: #9 > fff(1,:) = [0.0 : 0.02 : 1.0] * 200
octave-3.2.3.exe: #10 > close;
octave-3.2.3.exe: #11 > plot (fff(1,:), fff(2,:))
octave-3.2.3.exe: #12 > dateaxis
...produces a plot with far too many X-ticks (almost black X-axis)
##- range [0-400]
... yields a proper plot with neat labels.
I'm sorry that at the moment I have other priorities and no time to sort
this out further. I use dates in the range 1895-present and dateaxis.m
works OK then.
But.... the date range [0-400] (~ AD 1) is probably uninteresting for
financial/economic purposes anyway :-) so I suppose dateaxis.m works
fairly OK.
Perusing the nabble archive on datetick.m & dateaxis.m learned that
there was development aimed at making datetick.m a base script and
dateaxis.m a mere wrapper, but AFAICS this development was never
finished (please correct me if I'm wrong).
I'd say with your bug fixes (actually matching mine) dateaxis.m is
usable, and for better results datetick is available (although that also
can benefit from some polishing).
Best wishes,
Philip
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev