bugGNU Octave - Bugs: bug #66221, hgload/hsave not working with...

 
 

bug #66221: hgload/hsave not working with imagesc plus scatter

Submitter:  Muhali <muhali>
Submitted:  Mon 16 Sep 2024 09:13:20 AM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Ready For Test Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 9.2.0 Operating System:  * Any
Fixed Release:  None Planned Release:  9.3.0 (current stable)
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 24 Sep 2024 02:10:21 PM UTC, comment #5: 


> Once everything is plotted, should you not set the "nextplot" property to its stored value?


That should be happening here after all axes children have been added in the loop a couple of lines above:
https://hg.savannah.gnu.org/hgweb/octave/file/9d8f1b357cf8/scripts/plot/util/struct2hdl.m#l231

I thought that it was working as expected while testing the changes.
Does that not work correctly for you? Could you please give an example where the "nextplot" property isn't set correctly after `hgload` (with the updated `struct2hdl.m`)?

Markus Mützel <mmuetzel>
Group administrator
Tue 24 Sep 2024 01:47:47 PM UTC, comment #4: 

Good point. Once everything is plotted, should you not set the "nextplot" property to its stored value?

Anonymous
Tue 24 Sep 2024 10:06:11 AM UTC, comment #3: 

Thank you for your report and for tracking this down further.

`scatter` graphics object are "only" a couple of years old. (IIRC, they've implemented as patches previously.)
But I also wonder why that wasn't reported previously.

I think your proposed change wouldn't work for the following modified test case (I haven't actually checked though):

clf ; hold on
imagesc(randn(5,3)) ;
scatter(1:3, rand(3,1))
hold off
pause(2) ;
hgsave("/tmp/foo.ofig") ;
close
hgload("/tmp/foo.ofig") ;
pause(2) ;


(Note the "hold off" before saving the .ofig.)

I pushed the following alternative change to the stable branch that should be addressing the issue in both test cases. That change also adds a self test based on the modified version of your reproducer:
https://hg.savannah.gnu.org/hgweb/octave/rev/4fe43ca191b5

It should be appearing in the next minor version of Octave (9.3.0).

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Thu 19 Sep 2024 12:58:09 PM UTC, comment #2: 

The following fixes it but I am surprised this was not noticed earlier so there might be some unwanted side-effects or the fix has to happen elsewhere.


--- a/scripts/plot/util/struct2hdl.m    Fri Sep 06 15:46:48 2024 +0200
+++ b/scripts/plot/util/struct2hdl.m    Thu Sep 19 13:56:10 2024 +0100
@@ -261,7 +261,7 @@
       || ! any (strcmpi (s.properties.tag, {"colorbar", "legend"})))
     ## regular axes
     propval = {"position", s.properties.position};
-    hid = {"__autopos_tag__", "looseinset"};
+    hid = {"__autopos_tag__", "looseinset", "nextplot"};
     for ii = 1:numel (hid)
       prop = hid{ii};
       if (isfield (s.properties, prop))


Anonymous
Mon 16 Sep 2024 03:25:07 PM UTC, comment #1: 

I can confirm this with current dev (10.0.0)

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Mon 16 Sep 2024 09:13:20 AM UTC, original submission:  

This example

clf ; hold on
imagesc(randn(5,3)) ;
scatter(1:3, rand(3,1))
pause(2) ;
hgsave("/tmp/foo.ofig") ;
close
hgload("/tmp/foo.ofig") ;
pause(2) ;

shows that hgload/hsave do not work with imagesc and scatter used together.

Muhali <muhali>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 dasergatskov (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-09-24 mmuetzel Planned ReleaseNone 9.3.0 (current stable)
    2024-09-24 mmuetzel StatusNone Ready For Test
        Operating SystemGNU/Linux Any
    2024-09-24 mmuetzel CategoryPlotting with OpenGL Plotting
        Item GroupNone Incorrect Result

    Back to the top

    Powered by Savane 3.13-5884.
    Corresponding source code