Saving a .fig file as a .png
30 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to save .fig files as .png in order to include them in a Latex document. The plots look great in .fig format, but when I save them as .png files, the font sizes that I specified don't stick and the font sizes revert to something much smaller than I want. Is there a way to get around this. I would use the .fig files, but Latex doesn't seem to like this format. Thanks for any help.
0 Commenti
Risposta accettata
Jan
il 30 Giu 2017
You forgot to mention how you create the PNG file. With a screenshot the output equals the display on the screen exactly:
F = getframe(gcf);
imwrite(F.cdata, 'YouFile.png')
2 Commenti
Jan
il 30 Giu 2017
The code to create the figure does not matter. The code I've posted creates a screen copy of every figure. Did you try to run it?
Using gcf is less safe than defining the figure handle explicitely:
FigH = figure;
... your code
drawnow;
F = getframe(FigH);
imwrite(F.cdata, 'YouFile.png')
gcf can reply an unexpected figure, if the user clicks on another figure during the code runs.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Printing and Saving in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!