bugGNU Octave - Bugs: bug #58015, axis equal 'clears' the plot

 
 

bug #58015: axis equal 'clears' the plot

Submitter:  None
Submitted:  Sat 21 Mar 2020 07:11:37 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Aron Bergman Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 23 Mar 2020 03:45:10 PM UTC, comment #10: 

I pushed the patch to the development branch here https://hg.savannah.gnu.org/hgweb/octave/rev/5e49ba5bdcc1.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Sun 22 Mar 2020 06:26:05 PM UTC, comment #9: 

The attached patch fixes the issue for me.

The other issue I mentioned in comment #8 was caused by a local mis-configuration.

(file #48653)

Markus Mützel <mmuetzel>
Group administrator
Sun 22 Mar 2020 04:46:34 PM UTC, comment #8: 

Easier steps to reproduce the bug are:

figure;
fill([-0.5; 0.5; 0.5; -0.5], [-0.4; -0.4; 0.4; 0.4], 'r')
axis equal


Already before "axis equal" the axis limits seem to be off for me with hg id 925fe981a25c. That might be another issue though.
After "axis equal" the patch disappears because the zlims no longer include 0 (like Rik already wrote in comment #6).

Markus Mützel <mmuetzel>
Group administrator
Sun 22 Mar 2020 03:35:32 PM UTC, comment #7: 

comment #4:

> It seems that at least one of the messages did not get posted to this bug report.  Comment #3 references "my previous conclusion" but there is no posting on that.


"my previous conclusion" was the one I wrote in my original submission, probably should've specified that.

original submission:

> The original value of "plotboxaspectratio" was [1 1 1.25] and after playing around with it for a while I came to the conclusion that the plot will be cleared for values < 1.25.


comment #6:

> So, clearly there are workarounds for the time being.


Yeah, `axis square` works fine for my use case too.

Anonymous
Sun 22 Mar 2020 03:07:54 PM UTC, comment #6: 

The problem is that change to aspect ratio necessarily causes a change to the various X-, Y-, and Z-limits.  In the case of the Z-limit, the new range does not include Z==0 where the data points for the 2-D fill() function are plotted.  Hence, there is nothing to display.  I checked by generating the initial plot, and then executing


octave:41> zlim
ans =

   0   1

octave:42> axis equal
octave:43> zlim
ans =

   0.1022   0.8978

octave:44> zlim ([0, 1])


The last command makes the plot re-appear.

So, clearly there are workarounds for the time being.



Rik <rik5>
Group administrator
Sun 22 Mar 2020 02:49:31 PM UTC, comment #5: 

Marking as confirmed since I can reproduce this with the example given.

Rik <rik5>
Group administrator
Sun 22 Mar 2020 02:48:55 PM UTC, comment #4: 

It seems that at least one of the messages did not get posted to this bug report.  Comment #3 references "my previous conclusion" but there is no posting on that.

Separately, I'm pretty sure this issue is with limits, pbaspectratio and dataaspectratio.

Modifying the code to this


zlim ([-1, 1]);
axis equal
axis tight


Produces a plot which is probably what the user intended. 

Rik <rik5>
Group administrator
Sun 22 Mar 2020 01:19:38 PM UTC, comment #3: 

(Response to the OSX screenshots)
Hmm, are you running the 5.2.0 version too?

The first screenshot is what it looks for me during generation. My attached screenshot is what is left for me when the program is done.

I also attached a faster version of the generator.m (it only plots every 10th polygon).

What is your output of the following commands:

dbstop axis>__axis__ 229
generator(0,1);
debug> pbratio
debug> get(ca,"plotboxaspectratio"


My output is

pbratio =

   434.00   342.30   342.30

ans =

   1.0000   1.0000   1.2500


I also played around with set(ca, "plotboxaspectratio", [x y z]) a bit more, and my previous conclusion that z_new has to be >= z_old was wrong. My new conclusion is that z has to be greater than at least one of x or y for the plotted polygons to be visible.

file #48651)

Anonymous
Sat 21 Mar 2020 11:24:08 PM UTC, comment #2: 

I was a little hesitant to post the code before because copyright and stuff (gotta read up on that...), so I tried creating a MWE, which didn't go to well, so I decided that my professor probably won't mind, so here it is.

The generator function can be called with `generator(0,1)`.

(file #48640, file #48641)

Anonymous
Sat 21 Mar 2020 08:01:53 PM UTC, comment #1: 

Can you upload some example code so we can try to reproduce this?

Rik <rik5>
Group administrator
Sat 21 Mar 2020 07:11:37 PM UTC, original submission:  

I'm doing a lab in numerical analysis where we are given a function that will generate a plot with the fill command. The plot is supposed to look like a circle, but when generating the polygons it looks like an ellipse due to the axis scaling, so the last command is `axis equal`, but this seems to clear the plot for me.

I looked into the problem myself and when debugging axis.m[1] I found that works fine up until line 234[2], after that line the plot seems to be cleared. I ran the program again and kept track of the value of "plotboxaspectratio" and after it had been set on line 234 I reset it and the plot showed up again.

The original value of "plotboxaspectratio" was [1 1 1.25] and after playing around with it for a while I came to the conclusion that the plot will be cleared for values < 1.25.

I don't understand the reason why the aspect ratio of the z-value would impact this 2D plot, so I don't feel comfortable making a suggestion to a fix.

[1] https://hg.savannah.gnu.org/hgweb/octave/file/a7ba8d4a1da2/scripts/plot/appearance/axis.m
[2] https://hg.savannah.gnu.org/hgweb/octave/file/a7ba8d4a1da2/scripts/plot/appearance/axis.m#l234

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #48653:  bug58015_zlim.patch added by mmuetzel (1KiB - text/plain)
file #48650:  linux-output.png added by None (10KiB - image/png)
file #48651:  generator.m added by None (3KiB - text/x-objcsrc)
file #48644:  Screenshot@2020-03-22@at@8.46.12@AM.png added by None (551KiB - image/png - So , I ran the given code in MacOSX and I'm getting the circle which you mentioned. Maybe this is problem is limited to your operating system?)
file #48645:  Screenshot@2020-03-22@at@8.43.00@AM.png added by None (199KiB - image/png - So , I ran the given code in MacOSX and I'm getting the circle which you mentioned. Maybe this is problem is limited to your operating system?)
file #48641:  generator_data.mat added by None (1MiB - application/octet-stream)
file #48640:  generator.m added by None (3KiB - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (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 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-03-23 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2020-03-22 mmuetzel Attached File- Added bug58015_zlim.patch, #48653
        StatusConfirmed Patch Submitted
    2020-03-22 mmuetzel Release5.2.0 dev
        Operating SystemGNU/Linux Any
    2020-03-22 rik5 StatusNeed Info Confirmed
    2020-03-22 None Attached File- Added linux-output.png, #48650
        Attached File- Added generator.m, #48651
    2020-03-22 None Attached File- Added Screenshot@2020-03-22@at@8.46.12@AM.png, #48644
        Attached File- Added Screenshot@2020-03-22@at@8.43.00@AM.png, #48645
    2020-03-21 None Attached File- Added generator.m, #48640
        Attached File- Added generator_data.mat, #48641
    2020-03-21 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code