As MATLAB has changed its figure engine in R2014b I decided to rerun some of my code for getting better looking figures out of them. Unfortunately, the last one I have is a code that takes ages to run, and I would like to highly avoid to rerun the code for a nicer figure.
I saved the result in a .fig
file in R2013b. However, if I open it in R2014b, it still has the old format.
Is it possible to redraw the figure using the MATLAB R2014b plotting engine? If it is, how could I do it?
NOTE: Literally, the figure is opened and drawn with the new engine, however, it retains its old format. While a new figure with a title()
command would plot a nice big, bold title, if a redraw this figure using "drawnow" or I generate code for it, the format remains the same.
Example: This figure was created in 2013b, and redrawn in 2014b. You can see that the title does not plot in the same format as a title('whatever')
would plot in the new graphic handles. It looks like that a '.fig' saves and sets the default values for the version it has been generated. Thus plot colors, titles, labels etc will look like the old graphic handles when redrawn.
This can be tested with the following code. Note that this is an overly simplified problem, the question is not explicitly about titles or labels, but all graphic stuff in general.
rng(1)
figure()
x = 1:50;
y = rand(1, 50);
plot(x,y)
title('this NICE Title')
xlabel('labels!')
ylabel('some other labels','Interpreter','Latex')
If this code is run in 2013b and 2014b, saved as fig in both and then opened as fig in both, the next 2 figures appear:
The 2013b fig file: http://s000.tinyupload.com/index.php?file_id=02053933004513599550
drawnow
doesn't do anything? Also, is it a simple plot (plot
orscatter
output?). If so you canget
the data out of the figure quite easily. (Contours or something like that-- not so easy). – Instancycopyobj
? Something along the lines of this: https://mcmap.net/q/668435/-producing-subplots-and-then-combine-them-into-a-figure-later-in-matlab – Ridingerhgload
the figure, and then usecopyobj
on it to create a new copy out of it in the hope that it gets rendered with the new graphics system... Anyway I just tried reproducing the problem on my end and I coudnt; I used a simple plot saved in R2014a, and then load it the FIG-file in R2014b and it was rendered with the new graphics (smoothed lines and new colors and all)... Can you share the original FIG-file which is causing the problem, or at least create a simpler one that showcases the issue? – RidingerFile -> Generate Code...
. It will give you an m-file which replicates the plot, including the colours and fonts used when it was saved. You can then remove the lines pertaining to font sizes and colours and run the m-file. Can't test this myself because I don't have an old copy of MATLAB handy. – Hypoblast