Why am I unable to save a figure as a full page PDF-file in MATLAB?

68 views (last 30 days)
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
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
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Printing and Saving in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R14SP2

Community Treasure Hunt

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

Start Hunting!