# HG changeset patch # User Rik # Date 1437666345 25200 # Node ID e2feb806332a65d6bbefa2f59d9946b7904abe0e # Parent 31f89b12aaf7050a78f032a1f7c588f923144093 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. diff -r 31f89b12aaf7 -r e2feb806332a scripts/plot/draw/polar.m --- a/scripts/plot/draw/polar.m Wed Jul 22 20:27:11 2015 -0400 +++ b/scripts/plot/draw/polar.m Thu Jul 23 08:45:45 2015 -0700 @@ -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