changeset 32587:a6b7c5620240

polar.m: Populate rtick with center value on plot creation (bug #64991) * /scripts/plot/draw/polar.m: Adjust rtick parameter creation to include zero value from xtick list. Update rtick BIST to include center 0 value. * /etc/NEWS.10.md: Note change in polar to rtick property in Graphics backend section.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Tue, 12 Dec 2023 15:56:05 -0500
parents 8c4dfe87d2cf
children a2be40ce8fec 094a296b3ba1
files etc/NEWS.10.md scripts/plot/draw/polar.m
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.10.md	Mon Dec 11 23:47:10 2023 -0500
+++ b/etc/NEWS.10.md	Tue Dec 12 15:56:05 2023 -0500
@@ -7,6 +7,11 @@
 
 ### Graphics backend
 
+- `polar` plots now include the center tick mark value, typically 0, in
+the 'rtick' parameter when the plot is created.  Subsequent modifications
+to 'rtick' by `rticks` still only includes the center tick mark value if
+it is specified.
+
 ### Matlab compatibility
 
 - `height` and `width` are now aliases for the `rows` and `columns` functions.
--- a/scripts/plot/draw/polar.m	Mon Dec 11 23:47:10 2023 -0500
+++ b/scripts/plot/draw/polar.m	Tue Dec 12 15:56:05 2023 -0500
@@ -173,7 +173,7 @@
   set (hax, "xlim", [-maxr maxr], "ylim", [-maxr maxr]);
 
   xtick = get (hax, "xtick");
-  minidx = find (xtick > 0, 1);
+  minidx = find (xtick >= 0, 1);
   maxidx = find (xtick >= maxr, 1);
   if (! isempty (maxidx))
     rtick = xtick(minidx:maxidx);
@@ -333,9 +333,9 @@
   delete (get (hg, "children"));
 
   rtick = unique (get (hax, "rtick")(:)');
-  rtick = rtick(rtick > 0);
+  rtick = rtick(rtick >= 0);
   if (isempty (rtick))
-    rtick = [0.5, 1];
+    rtick = [0, 0.5, 1];
   endif
 
   ttick = unique (get (hax, "ttick")(:)');
@@ -638,14 +638,14 @@
 %!   close (hf);
 %! end_unwind_protect
 
-##Test rtick, ttick being properly set
-%!test
+##Test rtick, ttick being set - including the unlabeled 0 (bug #64991)
+%!test <*64991>
 %! hf = figure ("visible", "off");
 %! hax = gca ();
 %! unwind_protect
 %!   polar (hax, [1 2 3], [4 5 6]);
 %!   haxdata = get (hax);
-%!   assert (haxdata.rtick, [2 4 6]);
+%!   assert (haxdata.rtick, [0 2 4 6]);
 %!   assert (haxdata.ttick, [0:30:330]);
 %! unwind_protect_cleanup
 %!   close (hf);