Mercurial > hg > octave-nkf
changeset 20586:e2feb806332a
polar.m: Calculate 'rtick' property more accurately (bug #45513).
* polar.m (__calc_rtick__): if maximum rho value is above last rtick, then
extend rtick value through linear interpolation.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 23 Jul 2015 08:45:45 -0700 |
parents | 31f89b12aaf7 |
children | f248847b5071 |
files | scripts/plot/draw/polar.m |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/draw/polar.m +++ b/scripts/plot/draw/polar.m @@ -156,13 +156,20 @@ function rtick = __calc_rtick__ (hax, maxr) ## FIXME: workaround: calculate r(ho)tick from xtick + ## It would be better to just calculate the values, + ## but that code is deep in the C++ for the plot engines. savexlim = get (hax, "xlim"); saveylim = get (hax, "ylim"); set (hax, "xlim", [-maxr maxr], "ylim", [-maxr maxr]); xtick = get (hax, "xtick"); - rtick = xtick(find (xtick > 0, 1):find (xtick >= maxr, 1)); - if (isempty (rtick)) - rtick = [0.5 1]; + minidx = find (xtick > 0, 1); + maxidx = find (xtick >= maxr, 1); + if (! isempty (maxidx)) + rtick = xtick(minidx:maxidx); + else + ## Add one more tick through linear interpolation + rtick = xtick(minidx:end); + rtick(end+1) = xtick(end) + diff (xtick(end-1:end)); endif set (hax, "xlim", savexlim, "ylim", saveylim); endfunction