Bug in saving .fig (but not .png or .pdf) from when specifiying YAxis.Exponent as -6

6 views (last 30 days)
In my livescript (MATLAB R2023b), I programatically save some of my plots via saveas(). I'm currently saving as a .pdf, a .png, and a .fig.
When I first specify that that the plot should have a YAxis exponent of -6 (it defaults to -5), my plots look as expected in the produced/displayed MATLAB .fig, and in the saved .pdf and .png. BUT...when I open the saved .fig, it shows an exponent of 10^2147483647. Not 10^-6 as everything else does.
I've been able to reproduce this in a .m file as well, so it doesn't seem to be related to the .mlx.
This is how I'm saving the plots:
set(gcf, 'visible', 'on'); % have to do this bc livescripts sets off, but then the figs open as invisible later
saveas(gcf,plotFullFilename,'fig')
saveas(gcf,plotFullFilename,'png')
exportgraphics(gcf,allPlotsFilename,'append',true)
This is how I set the exponent:
axA.YAxis.Exponent = -6;
axB.YAxis.Exponent = -6;
If I comment out the exponent code and let it default to a yaxis exponent to -5, then the .fig saves with an exponent of -5.
But I don't want a y-axis exponent of -5. I want it in engineering notation, e.g. an exponent of -6. This looks like a bug to me. Any ideas?
  2 Comments
Voss
Voss on 13 Feb 2024
How are you opening the saved .fig files? When I open them using openfig, none of the y-axis exponents are 10^2147483647. (Same result if I open them through the OS, e.g., right-click in Windows Explorer and select Open.)
fn = dir('*.fig');
for ii = 1:numel(fn)
f = openfig(fn(ii).name,'visible');
end
Nicole009
Nicole009 on 13 Feb 2024
I was just double clicking the .fig in the Windows Explorer window. Interesting if your method is a temporary workaround. Looks like it is a documented bug per the accepted answer.

Sign in to comment.

Accepted Answer

Steven Lord
Steven Lord on 13 Feb 2024
This sounds like Bug Report 3147076 which is listed as fixed in release R2023b Update 6.
  3 Comments
Justus Gimsa
Justus Gimsa on 17 Sep 2024
@Steven Lord I still have this with the function (exportgraphics(gcf,....) in 2024a, that the exponent is gone - are people working on this? ;)
Steven Lord
Steven Lord on 17 Sep 2024
This particular bug is listed as fixed in both release R2023b Update 6 and release R2024a. Please contact Technical Support with a specific example and work with them to determine if there's another bug that manifests the same way that this bug fix introduced or exposed.

Sign in to comment.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!