changeset 27920:08630aedc41f

polar.m: Add small gap between grid and grid labels (bug #57553). * polar.m: Add a small gap (2% of maximum rtick value) between the labels for the circular grid on a polar plot and the line objects themselves. Clarify comment text.
author Rik <rik@octave.org>
date Wed, 08 Jan 2020 11:51:49 -0800
parents 1891570abac8
children 4be05a32ad2f
files scripts/plot/draw/polar.m
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/draw/polar.m	Mon Jan 06 22:29:51 2020 -0500
+++ b/scripts/plot/draw/polar.m	Wed Jan 08 11:51:49 2020 -0800
@@ -360,25 +360,27 @@
   patch (x(:,end), y(:,end), -ones (circle_points, 1),
          get (hax, "color"), "parent", hg);
 
-  ## Plot dotted circles
+  ## Plot grid circles
   line (x(:,1:end-1), y(:,1:end-1), lprops{:}, "parent", hg);
 
-  ## Outer circle is drawn solid
+  ## Outer circle (axes "box") is always drawn solid
   line (x(:,end), y(:,end), lprops{:}, "linestyle", "-", "parent", hg);
 
   ## Add radial labels
-  [x, y] = pol2cart (0.42 * pi, rtick);
+  ## Labels are arranged along a radius with an angle of 75 degrees.
+  ## 2% addition puts a small visual gap between grid circle and label.
+  [x, y] = pol2cart (0.42 * pi, rtick + (.02 * max (rtick(:))));
   text (x, y, num2cell (rtick), "verticalalignment", "bottom", tprops{:},
         "parent", hg);
 
-  ## add radial lines
+  ## Add radial lines
   s = rtick(end) * sin (ttick * pi / 180);
   c = rtick(end) * cos (ttick * pi / 180);
   x = [zeros(1, numel (ttick)); c];
   y = [zeros(1, numel (ttick)); s];
   line (x, y, "linestyle", ":", lprops{:}, "parent", hg);
 
-  ## add angular labels
+  ## Add angular labels
   tticklabel = num2cell (ttick);
   ## FIXME: This tm factor does not work as fontsize increases
   tm = 1.08;