bugGNU Octave - Bugs: bug #65749, [octave package] (statistics)...

 
 

bug #65749: [octave package] (statistics) hist3() help, axes flipped

Submitter:  Armin Müller <arm_in>
Submitted:  Wed 15 May 2024 06:18:34 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 9.1.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 17 May 2024 07:00:25 PM UTC, comment #5: 

In the corrected example that I provided, I have modified three points to get it right:
1) exchanged the indices "centers" 1 and 2
2) transposed counts'
3) made the y axis  (axis xy)

This is why I think the example quite is strange.

comment #2:


> figure
> [counts, centers] = hist3 (data);
> imagesc (centers{1}, centers{2}, counts')
> axis xy
> xlabel('X')
> ylabel('Y')


Armin Müller <arm_in>
Thu 16 May 2024 09:29:29 PM UTC, comment #4: 

from `help image`:


Implementation Note: The origin (0, 0) for images is located in the
     upper left.  For ordinary plots, the origin is located in the lower
     left.


i think that might be what you're seeing here.

Nicholas Jankowski <nrjank>
Group Member
Thu 16 May 2024 02:40:20 AM UTC, comment #3: 

maybe someone more familiar can confirm, but i believe image() files may use a different (1,1) location than regular arrays.

Nicholas Jankowski <nrjank>
Group Member
Wed 15 May 2024 07:19:21 PM UTC, comment #2: 

Maybe the call to imagesc() is wrong.
Or maybe the output of hist3() is wrong.

This modified call of imagesc() would provide the expected output, at least:


figure
[counts, centers] = hist3 (data);
imagesc (centers{1}, centers{2}, counts')
axis xy
xlabel('X')
ylabel('Y')


Armin Müller <arm_in>
Wed 15 May 2024 06:54:53 PM UTC, comment #1: 

yes it should be probably 'especially'.

this is part of the statistics package, which now handles code and issue tracking at

https://github.com/gnu-octave/statistics

looking at

demo hist3:


X = [
    1    1
    1    1
    1   10
    1   10
    5    5
    5    5
    5    5
    5    5
    5    5
    7    3
    7    3
    7    3
   10   10
   10   10];

[N,C]=hist3(X)
N =

   2   0   0   0   0   0   0   0   0   2
   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   5   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   0
   0   0   3   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   2

C =
{
  [1,1] =

     1.4500   2.3500   3.2500   4.1500   5.0500   5.9500   6.8500   7.7500   8.6500   9.5500

  [1,2] =

     1.4500   2.3500   3.2500   4.1500   5.0500   5.9500   6.8500   7.7500   8.6500   9.5500



C's look ok, but they're uniform so it's tough to tell if they're flipped.

looking at N, the three corners with data in the plot look like they match the three non-zero corner bins. is the issue that images use different array zeros?

Nicholas Jankowski <nrjank>
Group Member
Wed 15 May 2024 06:18:34 PM UTC, original submission:  


help hist3

says

"[...] The return values, N and C, are the bin counts and centers respectively. These are specially useful to produce intensity maps:

[counts, centers] = hist3 (data);
imagesc (centers{1}, centers{2}, counts)"

However, the X and Y axes are flipped. Example code and screenshot attached. Octave 9.1.0 on Windows 10.

Would a native speaker say "specially" or "especially"?

Armin Müller <arm_in>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #56058:  hist3_example.png added by arm_in (48KiB - image/png)
file #56057:  hist3_example.m added by arm_in (262B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by arm_in (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-05-15 nrjank Summaryhist3() help, axes flipped [octave package] (statistics) hist3() help, axes flipped
    2024-05-15 arm_in Attached File- Added hist3_example.m, #56057
        Attached File- Added hist3_example.png, #56058

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code