Why am I unable to save a figure as a full page PDF-file in MATLAB?
69 views (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Commented: LO
on 22 Dec 2021
When I save my figure to a PDF file, there is no option to make it fill the page, as there is when I print it. For example,
figure
plot(rand(100 ,2))
Then I use the "File->Save As" menu option and select the PDF file type.
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
The ability to save a figure as a PDF-file which fills the page is not available in MATLAB.
To work around this issue, you can change the size of the figure and then save it to a PDF-file.
For example, the following code sets the size of the figure to 8.5-by-11 inches:
figure
plot(rand(100 ,2))
set(gcf,'units','inches')
old_pos = get(gcf,'position'); % save current "position" to be restored later
set(gcf,'Position',[0 0 8.5 11])
Then save the file in a PDF format using the "File->Save As" menu option.
You can restore the figure back to its original size using the "old_pos" variable:
set(gcf,'position', old_pos)
1 Comment
LO
on 22 Dec 2021
I can't export a figure as PDF neither through the manual export from the fig menu, or through the print command, or the saveas command.
Apparently this happens randomly: some figures are saved as PDF other figures not.
More Answers (0)
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!