Mercurial > octave
changeset 23292:6cbf5c2d4d55 stable
datetick.m: Fix uneven range bugs (bug #50493)
* datetick.m: Use round() and floor() to calculate an even series of ticks.
author | Lars Kindermann |
---|---|
date | Fri, 10 Mar 2017 13:15:23 +0100 |
parents | 92d60bf45889 |
children | ed3d5186ffcf 3b2dbed26762 |
files | scripts/plot/appearance/datetick.m |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/appearance/datetick.m Thu Mar 16 09:15:19 2017 -0700 +++ b/scripts/plot/appearance/datetick.m Fri Mar 10 13:15:23 2017 +0100 @@ -210,15 +210,19 @@ minmonth = ifelse (minmonth == 0, 1, minmonth); maxmonth = sep * ceil (maxmonth / sep); rangemonth = (minmonth:sep:maxmonth)'; + tickdays = round (1 + 28*mod (rangemonth, 1)); ticks = datenum ([repmat(minyear, size(rangemonth)), ... - rangemonth, ... - ones(size (rangemonth))]); + floor(rangemonth), ... + tickdays]); else sep = __calc_tick_sep__ (minyear, maxyear); minyear = sep * floor (minyear / sep); maxyear = sep * ceil (maxyear / sep); rangeyear = (minyear:sep:maxyear)'; - ticks = datenum ([rangeyear, ones(rows(rangeyear),2)]); + tickmonth = round (1 + 12*mod (rangeyear, 1)); + ticks = datenum ([floor(rangeyear), ... + tickmonth, ... + ones(rows (rangeyear), 1)]); endif endif endif