I have a plot that needs to be printed out in exact dimensions on paper, since it is in scale and from it on paper some things will be measured. What would be the easiest (is it possible at all) way to do it?
Asked
Active
Viewed 2.7k times
1 Answers
24
EDIT:
%# create some plot, and make axis fill entire figure
plot([0 5 0 5], [0 10 10 0]), axis tight
set(gca, 'Position',[0 0 1 1])
%# set size of figure's "drawing" area on screen
set(gcf, 'Units','centimeters', 'Position',[0 0 5 10])
%# set size on printed paper
%#set(gcf, 'PaperUnits','centimeters', 'PaperPosition',[0 0 5 10])
%# WYSIWYG mode: you need to adjust your screen's DPI (*)
set(gcf, 'PaperPositionMode','auto')
%# save as TIFF
print -dtiff -r0 out.tiff
(*): http://www.mathworks.com/help/matlab/creating_plots/printing-images.html

Amro
- 123,847
- 25
- 243
- 454
-
Hi Amro. Thanks for answering. Okey, I understood the above part ... then what? – Rook Aug 30 '10 at 14:13
-
@Rook: please refer to this page: http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f2-14338.html – Amro Aug 30 '10 at 14:14
-
@Amro - yes, I think I even managed to stumble onto that page while looking for it. But it only deals with the ratio of image on screen/paper. I need a way to specify in cm, for example, how big do I want the image to go out on paper (I have a really big plotter on my disposal, and wish to plot some diagrams that are 50x100cm - but they need to be exactly 50x100cm, since students will read values off them). – Rook Aug 30 '10 at 14:17
-
@Rook: I updated the code.. since I don't have a printer at hand, could you try to see if this works as intended? – Amro Aug 30 '10 at 15:13
-
@Amro - no, it's still not going out right. I modified your program a little (since rand() is difficult, since it gives out a different data every time, so you cannot "play" with parameters) as to print a "box" -> x = [0 5 0 5], y = [0 10 10 0], plot(x,y) <- but on paper it still comes out wrong. – Rook Aug 30 '10 at 15:37
-
2@Rook: Can you also try the other approach using PaperPositionMode=auto (after customizing your monitor's DPI settings)? Also make sure to use TIFF images as output (for some reason EPS/PDF seemed to be a bit bigger) – Amro Aug 30 '10 at 15:56
-
2@Amro - This approach works ... 5x10 cm exactly on paper. Thanks Amro for all your help. This is very important to me. It will save me a lot of time compared to manually configuring all those print parameters. – Rook Aug 30 '10 at 16:31
-
@Amro, Sorry for commenting on such an old question, but... did you figure out why the EPS/PDF get a little bit bigger? – jmlopez Jun 03 '12 at 19:19
-
@jmlopez: they weren't bigger actually, it was only an issue with my EPS/PDF viewer settings (after all, you can verify this by using an actual printer instead of measuring things off the screen!)... See my other answer from [here](http://stackoverflow.com/a/7576598/97160) for an example where I output a PDF file, and the measurement were exact. – Amro Jun 03 '12 at 19:37
-
The commented line worked while the WYSIWYG did not. – Wok May 04 '15 at 13:14