bugGNU Octave - Bugs: bug #67280, Bug in rose() function when center...

 
 

bug #67280: Bug in rose() function when center of bins are provided

Submitter:  José Luis García Pallero <jgpallero>
Submitted:  Sat 05 Jul 2025 09:04:33 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Patch Submitted Assigned to:  None
Originator Name:  jgpallero Open/Closed:  * Open
Release:  * 10.2.0 Release: 
Operating System:  * Any Fixed Release:  11.1.0 (current default)
Planned Release:  11.1.0 (current default)
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 12 Jul 2025 07:55:06 PM UTC, comment #4: 

Damn, I looked at the pics and they look the same to me (and still do).

So may be there si something else is going on there.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sat 12 Jul 2025 07:40:16 PM UTC, comment #3: 

With patch applied, 'test rose' produces two failures.  The log file is attached.  Given that rose bins shifted location this is not surprising.  If testing shows the two failing tests match Matlab then they should be updated.  In addition, there should be a note in etc/NEWS.11.md in the Matlab Compatibility section mentioning that there may be a change in output for user's existing plots.

(file #57402)

Rik <rik5>
Group administrator
Sun 06 Jul 2025 08:56:24 AM UTC, comment #2: 

It works! Thanks

José Luis García Pallero <jgpallero>
Sun 06 Jul 2025 03:08:04 AM UTC, comment #1: 

The diff:


diff -r 6be49707a9ac scripts/plot/draw/rose.m
--- a/scripts/plot/draw/rose.m  Fri Jul 04 17:15:02 2025 -0700
+++ b/scripts/plot/draw/rose.m  Sat Jul 05 23:05:17 2025 -0400
@@ -119,12 +119,12 @@
     if (isrow (counts))
       counts = counts(:);
     endif
-    counts(end-1,:) += counts(1,:);  # Combine counts for first, last bin
+    counts(1,:) += counts(end-1,:);  # Add wraparound bin to first bin (not vice versa)
     ## FIXME: Remove in Octave 11 if no bug reports filed
     if (any (counts(end,:)))
       error ("rose: internal error, histc returned count for theta == 2*pi, please file a bug report");
     endif
-    counts([1,end], :) = [];         # remove temporary bins
+    counts([end-1,end], :) = [];     # Remove wraparound and overflow bins (not first bin)
   endif

   binedge = [binedge ; zeros(size(binedge)); zeros(size(binedge)); binedge];


fixed it for me.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sat 05 Jul 2025 09:04:33 PM UTC, original submission:  

See this piece of code:

A = 1:359;
A = [A ones(1,50)*4];
A = A*pi./180;
cb = [0.0:12.0:348.0]*pi./180.0;
nb = length(cb);
subplot(1,2,1);
rose(A,nb);
subplot(1,2,2);
rose(A,cs);

I create sequential angular values from 1 to 359 degrees plus 50 more values of 4 degrees. I convert them to radians. I want to plot a rose diagram using 30 bins, i.e., bins of  12 degree width. In the first plot I call rose() with 30 as second argument, i.e., the bins are created starting in 0 as an edge, so the most frequent bin ins the one from 0 to 12. In the second plot I use a vector of bins centers starting in zero, i.e., the first bin is 354/6, the second one 6/18, etc. Attached I send the results of the code running in Octave and Matlab.

As it can be seen, the most frequent bin in Matlab is right computed (0/12 and 354/6 for both calls of rose()), but in Octave, when calling rose() with the bin centers vector the result is wrong as the most frequent bin is 342/354.

José Luis García Pallero <jgpallero>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #57402:  rosetest.log added by rik5 (2KiB - text/x-log)
file #57368:  matlab.png added by jgpallero (44KiB - image/png)
file #57369:  octave.png added by jgpallero (38KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by philipnienhuis (Updated the item)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by jgpallero (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    19:40 rik5 Attached File- Added rosetest.log, #57402
        Item GroupIncorrect Result Matlab Compatibility
        Fixed ReleaseNone 11.1.0 (current default)
        Planned ReleaseNone 11.1.0 (current default)
    2025-07-06 philipnienhuis StatusNone Patch Submitted
    2025-07-05 jgpallero Attached File- Added matlab.png, #57368
        Attached File- Added octave.png, #57369

    Back to the top

    Powered by Savane 3.15-e6e5.
    Corresponding source code