Savefig-openfig problem regarding units of UI elements

Hello all,

we’re having a bit of a problem when creating a figure with UI elements, saving and then opening it again. In particular, it looks like savefig() messes up the position property when the UI elements are placed in a panel.
I’ve attached a function to replicate this; in figure f2, only the panel is visible because the button’s positions are completely wrong; so currently, we’d have to reset the position property as in figure f3.

We’re not really sure if this is a bug or if we just need a bit of a workaround - does anyone else have better ideas how to deal with this? We have a lot of UI elements on UI panels, so at the moment it doesn’t really matter if we build the figure from scratch each time or save the figure and reset the position properties…

Additional system infos: tested on Linux + Octave dev (as of 05/2020), and on Windows 10 + Octave 6.1

SaveOpenFigProblem.m (484 Bytes)

Thanks for the report.
Apart from this help forum, we also have a bug tracker on savannah for reporting issues like this:
GNU Octave - Bugs: Browse Items [Savannah]

I pushed a patch here that should fix this:
octave: 216ef81dafb6 (

This will be part of the next bug fix release for Octave 6.
Since this is just a change in an .m file, you could also replace the existing file with the one from the repository:
octave: 216ef81dafb6 scripts/plot/util/struct2hdl.m (

thank you for the fix! I wasn’t completely sure it was a bug.
However, we found a similar issue regarding the CData property of pushbuttons. In my dev version, bug 58144 is fixed, but that didn’t make it into the 6.1 release. (I also haven’t pulled your patch for struct2hdl).

In the attached minimal example, a button is assigned a CData (diagonal white line on black background), the fig is closed and then opened again. On Windows 10 + Octave 6.1 (without the CData scaling fix), this is not a problem, but on my system (WITH the CData scaling fix), the CData is not displayed anymore when I call openfig in the end (yet it is there in the properties).

Could this be related to that bugfix in combination with the save-/openfig?

SaveOpenCDataProblem.m (188 Bytes)

I can confirm what you describe with a recent build from the default branch (which will eventually become Octave 7) with and without the change in struct2hdl here.
The icon does still re-appear after openfig in Octave 6.1.

I didn’t understand completely: Which version of Octave are you using on your system (that is affected)? Is it Octave 6.1 + the fix for bug #58114? Or do you use a different build?

Could you please open a bug report on Savannah?

Thanks for the confirmation - I opened a bug report here.
Sorry for the confusion - my system is Linux + the dev version pulled in May 2020. As I’ve written in the bug report, my old dev version as of March 2020 (before bug #58144 was fixed) does display the CData correctly after I open the figure again. Octave 6.1 doesn’t seem to be affected.
(edited to link the right bug this time)