export_fig: PaperPosition not considered when exporting to PDF?

1 Ansicht (letzte 30 Tage)
Marco
Marco am 23 Mai 2015
Bearbeitet: Marco am 23 Mai 2015
Hello, It seems as if the 'PaperPosition' vector is not considered when exporting to PDF by the otherwise excellent working File Exchange submitted function "export_fig". Does anybody else encounter this problem, or better, would anybody has a suggestion how to program things so that printing to A4 respects certain spacing between my figure and the paper borders, and forcing the figure to appear at certain width and height given in millimeters?
This is what I configured, not producing the wanted effect:
figureheight = 1200; figurewidth= figureheight / 1.618; % Golden Ration is known to be roughly = 1,618
set(gcf,'Position',[100 180 figurewidth figureheight],... % for screen
'PaperUnits','centimeters',... % for printing
'PaperOrientation','portrait',...
'PaperPosition',[3.5 16.5 figurewidth/100 figureheight/100],...
'PaperPositionMode','manual',...
'PaperSize',[20.984 29.6774],...
'PaperType','A4');
% (...)
export_fig(pdffilename, '-pdf', '-nocrop');

Antworten (1)

Marco
Marco am 23 Mai 2015
Bearbeitet: Marco am 23 Mai 2015
After some hard hours of search for information and study of some of the export_fig package code I think that I found the answer myself:
export_fig generates a PDF by first generating an EPS and then converting the EPS to PDF. Somewhere in the export_fig processing pipeline it for this calls from its print2eps function the MATLAB internal print function. For the MATLAB internal print function THE MATHWORKS notes in the documentation that it does not support the PaperPosition information if EPS export is called.
At least in the print2eps function (as of May 2015) I couldn't find any workaround for this and therefore conclude that the PaperPosition information indeed becomes lost.
The export_fig function seems to perfectly export the figure as it also would appear as a figure on screen. Thus, if any special layout is wanted, the figure has to already show this on the screen.
I would be happy if someone could correct my findings to be wrong and/or could suggest me a solution taking into account the PaperPosition information.

Community Treasure Hunt

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

Start Hunting!

Translated by