help-octave
[Top][All Lists]
Advanced

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

Re: How to inspect Datenum code


From: Ozzy Lash
Subject: Re: How to inspect Datenum code
Date: Wed, 6 Sep 2017 17:11:40 -0500



On Wed, Sep 6, 2017 at 4:20 PM, Mike Miller <address@hidden> wrote:
On Wed, Sep 06, 2017 at 13:56:35 -0700, gciriani wrote:
> Do you mean a fixed datenum or a fixed datetick? To me it seems a datetick
> bug.

No, the bug is in datenum.

The datetick function figures out how to divide the time range into some
number of ticks.

When the time span is less than 3 months, it is divided evenly into some
intervals that make sense.

When the time span is more than 3 months, as in your example, it
attempts to divide the span into even intervals and may end up passing a
fractional month number into datenum to calculate those values.

The datenum function is now fixed to allow fractional month numbers when
given an array of time values, as in

    datenum ([2017 1 1; 2017 1.5 1; 2017 2 1])

This makes calculating ranges across some span of months easier.

If you want to work around this in Octave 4.2.1, you can use the
"keepticks" option to the datetick function to prevent it from
recalculating the tick intervals.

--
mike

The change to datenum.m that is in that bug report looks pretty simple to apply by hand, or you could download the current mercurial version of datenum.m http://hg.savannah.gnu.org/hgweb/octave/raw-file/92d60bf45889/scripts/time/datenum.m and replace your old version with it.

Bill

reply via email to

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