How to adjust the schedule in Matlab to a specific size?

As a rule, I want to build a rather complex xy graph (many overlapping curves) in A3 format so that:

A4 210x297 A3 = A4*2 = 420 x 297 ... - 10mm each side = 400 x 277 (size of desired plot window) 

What is the easiest way to set the graph size to fit that size when printing in PDF (or any other general output format)?

+7
printing matlab plot export-to-pdf
Sep 26 '11 at 10:15
source share
4 answers

See matlab documentation for figure properties .

Namely:

  • PaperSize - Explicitly defines the size of the canvas.
  • PaperType - Installs PaperSize in one of several standard paper sizes.

The built-in plotting tool allows you to save figures as all kinds of image formats, so you should be good to go. When playing with the above settings, your number should be correct for printing. A.

Happy schedule!

+8
Sep 26 '11 at 22:38
source share

As explained by @LewisNorton , you need to set the Paper*** properties of the shape. Below is an example of creating a PDF file with dimensions of 420 x 297 mm (size A3), where the margins between the graph and the borders of the file are 10 mm each (upper, lower, left, right).

 %# centimeters units X = 42.0; %# A3 paper size Y = 29.7; %# A3 paper size xMargin = 1; %# left/right margins from page borders yMargin = 1; %# bottom/top margins from page borders xSize = X - 2*xMargin; %# figure size on paper (widht & hieght) ySize = Y - 2*yMargin; %# figure size on paper (widht & hieght) %# create figure/axis hFig = figure('Menubar','none'); plot([0 1 nan 0 1], [0 1 nan 1 0]), axis tight set(gca, 'XTickLabel',[], 'YTickLabel',[], ... 'Units','normalized', 'Position',[0 0 1 1]) %# figure size displayed on screen (50% scaled, but same aspect ratio) set(hFig, 'Units','centimeters', 'Position',[0 0 xSize ySize]/2) movegui(hFig, 'center') %# figure size printed on paper set(hFig, 'PaperUnits','centimeters') set(hFig, 'PaperSize',[XY]) set(hFig, 'PaperPosition',[xMargin yMargin xSize ySize]) set(hFig, 'PaperOrientation','portrait') %# export to PDF and open file print -dpdf -r0 out.pdf winopen out.pdf 

screenshot_MATLABscreenshot_PDF

Without a printer at hand, I use a virtual ruler to verify measurements; Just display the PDF file with your preferred view and set the zoom level to 100% (I use Sumatra PDF ). If you want to try it yourself, just keep in mind that some viewers (Adobe Reader) may use a custom DPI that does not match the default resolution in the system (mine at 96 pixels / inch).

Here you can see the bottom and left margins equal to 10mm . The same is true for the other two fields:

margins_1cm

Please note that in the above example, I made an axial coating of the whole figure (without the gray area in the figure). By default, MATLAB leaves blank space for ticks, tags, headers, etc. This, of course, is different from the fields mentioned above, which I assume you already know :)

+23
Sep 27 '11 at 22:57
source share

Download export fig ( Ghostscript required).

Try to run:

  surf(peaks);title('voila');export_fig 'test.pdf'; 

When using Adobe to print a PDF file, set Page Scaling to Fit To Print Area.

+2
Sep 26 '11 at 22:43
source share

If you need a custom shape (for example, for a long, thin plot or for a square plot to include in another file), set the PaperSize and PaperPosition .

 set(gcf, 'PaperSize', [30 10], 'PaperPosition', [0 0 30 10]) print -pdf filename 
0
May 24 '17 at 14:08
source share



All Articles