bugGNU Octave - Bugs: bug #52272, quiver arrowhead too large


bug #52272: quiver arrowhead too large

Submitter:  Muhali <muhali>
Submitted:  Tue 24 Oct 2017 08:49:55 AM UTC
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Need Info Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Thu 15 Feb 2024 08:57:40 PM UTC, comment #17: 

appears this effort stalled out, the arrow head sizes in octave 9.0.90 are still significantly larger than in any of the attached matlab comparisons. 

@rik, i don't supposed you stashed any notes on the sizing algorithm you may have been working on in the backgroud?

Nicholas Jankowski <nrjank>
Group Member
Fri 10 Nov 2017 12:02:37 PM UTC, comment #16: 

I've attached requested output

Richard <crobar>
Fri 10 Nov 2017 01:41:59 AM UTC, comment #15: 

I've also fixed the issue where the arrowshaft was not scaled when there was just a single vector.

Rik <rik5>
Group administrator
Fri 10 Nov 2017 01:40:12 AM UTC, comment #14: 

I now have the arrowshaft and the angle that the arrowheads make with the arrowshaft correct, but I still can't figure out the algorithm that Matlab is using for the size of the arrowhead.  New test code for Matlab is:

hq = quiver ([5 5 5 5 5], [5 5 5 5 5], [1 2 3 1 0], [0 1 3 4 5]);
saveas (gcf, 'tstquiver4a.png');
set (hq, 'maxheadsize', 0.4);
saveas (gcf, 'tstquiver4b.png');

Rik <rik5>
Group administrator
Thu 09 Nov 2017 04:47:08 PM UTC, comment #13: 

I can't move forward until I see the results from Matlab for the code in comment #12.

Rik <rik5>
Group administrator
Sun 05 Nov 2017 05:44:41 AM UTC, comment #12: 

Actually, a better test case to run would be

quiver ([5 6 8], [5 5 5], [10 10 10], [0 0 0]);
saveas (gcf, 'tstquiver3.png');

Rik <rik5>
Group administrator
Thu 26 Oct 2017 04:08:51 PM UTC, comment #11: 

@Richard: Could you try this code?

quiver ([5 6], [5 5], [1 1], [0 0]);
saveas (gcf, 'tstquiver3.png');

This should produce a very clean test case without any sqrt(2) factors obscuring the algorithm.

Rik <rik5>
Group administrator
Thu 26 Oct 2017 03:41:23 PM UTC, comment #10: 

Thanks.  It looks like Octave is correctly calculating the length of the arrowshaft, but the arrowhead is too big.  At least that points towards which part of the algorithm in _quiver_.m needs modification.

Rik <rik5>
Group administrator
Thu 26 Oct 2017 03:19:14 PM UTC, comment #9: 

See uploaded file tstquiver2.png

Richard <crobar>
Thu 26 Oct 2017 03:16:03 PM UTC, comment #8: 

Could someone with Matlab try this code?

quiver ([5 6], [5 6], [1 1], [1 1])
saveas (gcf, 'tstquiver2.png')

According to the documentation for AutoScale

Scale the arrow length to fit within the grid-defined coordinate data and scale arrows so that they do not overlap. The quiver function then applies the AutoScaleFactor to the arrow length.

The idea I'm trying to check is whether AutoScale has a specific case for a single arrow (for which there is no grid).

Rik <rik5>
Group administrator
Thu 26 Oct 2017 07:23:31 AM UTC, comment #7: 

I would guess arrowhead size is proportional to the vector length when only drawing one arrow. See the MaxHeadSize property, defined as "Maximum size of arrowhead, specified as a scalar value in units relative to the length of the arrow."

Richard <crobar>
Thu 26 Oct 2017 06:48:26 AM UTC, comment #6: 


>> version

ans =

    ' (R2017b)'

>> quiver (5,5,1,1);
>> saveas (gcf, 'tstquiver.png')

Marco Caliari <caliari>
Group Member
Thu 26 Oct 2017 04:26:22 AM UTC, comment #5: 

Here is the Quiver Properties:



Dmitri A. Sergatskov <dasergatskov>
Thu 26 Oct 2017 04:25:16 AM UTC, comment #4: 

Changing category back to "Need Info".

@Clark: Can you start Matlab without any user customizations and see if you get the same size figure?

@Dmitri: It could also be the case that Matlab has special logic for weird corner cases such as this one.

Rik <rik5>
Group administrator
Thu 26 Oct 2017 04:17:49 AM UTC, comment #3: 

If I try an example from the matlab documentation

I get pretty much an identical figure. I think we want a second opinion... Perhaps Clark Dunson has some custom settings?!


Dmitri A. Sergatskov <dasergatskov>
Thu 26 Oct 2017 03:38:07 AM UTC, comment #2: 

Marking as confirmed.  The attached jpg from Matlab shows a much smaller arrowhead.

Rik <rik5>
Group administrator
Tue 24 Oct 2017 04:12:25 PM UTC, comment #1: 

What does Matlab do?  Could someone run the sample code and upload the image that it produces?

For Octave, the arrowhead size is calculated at about 20% of the size of the grid.  Since your grid is 1x1 this comes out to about 0.2.  That looks big when the axes limits are tight in around the object, but looks okay when the view is larger.  Try

quiver (5,5,1,1);
axis ([0, 10, 0, 10])

Rik <rik5>
Group administrator
Tue 24 Oct 2017 08:49:55 AM UTC, original submission:  

Using a simple

quiver(5, 5, 1, 1)

produces an arrow whose head is too large.

Muhali <muhali>


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

Attach Files:

Attached Files
file #42360:  tstquiver4a.png added by crobar (19KiB - image/png)
file #42361:  tstquiver4b.png added by crobar (20KiB - image/png)
file #42357:  tstquiver3.png added by muhali (27KiB - image/png - quiver test case 3)
file #42272:  tstquiver2.png added by crobar (16KiB - image/png)
file #42263:  tstquiver.png added by caliari (17KiB - image/png)
file #42262:  quiver.jpg added by clarkman (13KiB - image/jpeg)


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 crobar (Posted a comment)
  • -email is unavailable- added by caliari (Updated the item)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by clarkman (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by muhali (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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-02-15 nrjank Operating SystemGNU/Linux Any
    2017-11-10 crobar Attached File- Added tstquiver4a.png, #42360
        Attached File- Added tstquiver4b.png, #42361
    2017-11-09 muhali Attached File- Added tstquiver3.png, #42357
    2017-10-26 crobar Attached File- Added tstquiver2.png, #42272
    2017-10-26 caliari Attached File- Added tstquiver.png, #42263
    2017-10-26 rik5 StatusConfirmed Need Info
    2017-10-26 rik5 Item GroupNone Matlab Compatibility
        StatusNeed Info Confirmed
    2017-10-26 clarkman Attached File- Added quiver.jpg, #42262
    2017-10-24 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code