bugGNU Octave - Bugs: bug #61945, newplot changes axes of current...

 
 

bug #61945: newplot changes axes of current figure

Submitted by:  Muhali <muhali>
Submitted on:  Thu 27 Jan 2022 02:35:17 PM UTC
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  In Progress Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Sat 30 Apr 2022 03:38:13 PM UTC, comment #6: 

I'm attaching a test script that can eventually be used to verify this bug report.  Calling newplot with an input axes handle should not change gca().

close all;

fig1 = figure;
hax1 = axes;
printf ("hax1 = %f\n", double (hax1));
fig2 = figure;
hax2 = axes;
printf ("hax2 = %f\n", double (hax2));
printf ("gca before newplot = %f\n", double (gca));
h = newplot (hax1);
printf ("gca after newplot = %f\n", double (gca));
printf ("handle returned from newplot (should be hax1) = %f\n", double (h));

(file #53165)

Rik <rik5>
Project Administrator
Sat 30 Apr 2022 03:25:26 PM UTC, comment #5: 

Re-opening and re-titling bug report.

I reverted the changeset on the stable branche because it was causing other problems.  A comprehensive solution needs to be developed for this bug and for bug #62373.

Rik <rik5>
Project Administrator
Sat 29 Jan 2022 11:55:38 PM UTC, comment #4: 

Verified the changeset.  Marking as Fixed and closing report.

Rik <rik5>
Project Administrator
Fri 28 Jan 2022 05:52:44 PM UTC, comment #3: 

@Pantxo: Thanks. That fixes the original issue for me. And it matches what Matlab is doing if newplot is called with an axes handle.

I pushed your patch to stable here:
https://hg.savannah.gnu.org/hgweb/octave/rev/fdd58773ac02

Marking as ready for test.

Markus Mützel <mmuetzel>
Project Member
Fri 28 Jan 2022 05:34:27 PM UTC, comment #2: 

I see no reason for newplot to affect the figure currentaxes property, so the simple attached change should do the trick.

(file #52768)

Pantxo Diribarne <pantxo>
Project Member
Thu 27 Jan 2022 06:16:00 PM UTC, comment #1: 

Confirmed also on Windows and with 7.0.90. (Both in Matlab and Octave. They behave differently.)

We are calling `newplot` in `plot`. And that function is setting the "currentaxes" property of the parent figure. That's probably why `gca` has changed after the `plot` command.

Markus Mützel <mmuetzel>
Project Member
Thu 27 Jan 2022 02:35:17 PM UTC, original submission:  

consider the following code:

ax = subplot(1,2,1) ;
plot(rand(5,1), rand(5,1))
subplot(1,2,2) ;
get(gca, 'position')
plot(ax, rand(5,1), rand(5,1))
get(gca, 'position')

It should show two identical position values because the current axis has not changed. It does so in Matlab but not in Octave.

Muhali <muhali>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #53165:  tst_newplot.m added by rik5 (346B - text/x-matlab)
file #52768:  bug61645.patch added by pantxo (1003B - text/x-patch)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by mmuetzel (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 project members can vote.

     

     

     

     

    Follow 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-04-30 rik5 Attached File- => Added tst_newplot.m, #53165
    2022-04-30 rik5 StatusFixed => In Progress
        Open/ClosedClosed => Open
        Summaryplot(ax,...) changes current axis => newplot changes axes of current figure
    2022-04-30 rik5 Dependencies- => Depends on bugs #62373
    2022-01-29 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2022-01-28 mmuetzel StatusPatch Submitted => Ready For Test
    2022-01-28 pantxo Attached File- => Added bug61645.patch, #52768
        StatusConfirmed => Patch Submitted
    2022-01-27 mmuetzel Item GroupNone => Matlab Compatibility
        StatusNone => Confirmed
        Release6.4.0 => dev
        Operating SystemGNU/Linux => Any

    Back to the top


    Powered by Savane 3.9