altmany / export_fig

A MATLAB toolbox for exporting publication quality figures
BSD 3-Clause "New" or "Revised" License
1.28k stars 368 forks source link

It doesn't seem like it is possible to set the size of a pdf when exporting #277

Closed s7jones closed 5 years ago

s7jones commented 5 years ago

I have tried setting the size of the pdf using set(fig,'PaperSize',[desired_width_cm desired_height_cm]); before calling export_fig, but it doesn't seem to work.

Any ideas? Is this something export_fig is supposed to support?

altmany commented 5 years ago

By default, export_fig does not set the PDF paper size and ignores the figure's Paper* properties. One reason for this is that export_fig removes empty margins by default, and this reduces the relevant print area.

I just added a new flag (-preserve_size) that enables users to override this behavior and use the original figure's PaperSize as the paper-size of the output EPS/PDF file.

PaperSize and the new -preserve_size option are irrelevant and ignored when you output to any other file formats than PDF/EPS.