How to print figure precisely to A4 without scale

57 views (last 30 days)
Hi,
Firstly thanks to anyone who can help me with this problem.
I have a program for academic work that produces some figures. On these figures are measurements that I would like to be precisely the same as on the paper that I print it from. However after several attempts from online research (paper type, orientation, size) I cannot get the axis measurement to be true to when I measure it on paper (with a ruler) therefore affecting the size of my figure.
Is there a specific way to export to a printable file (as this PC does not have direct printing links) that I can print to typical A4 and the measurements will match up.
In terms of coding all I have is, the rest I tried to change in the sub-menus:
figure,plot(w,-al,-w,-al)
Thanks in advance.

Answers (2)

per isakson
per isakson on 16 Jan 2013
Did you search for a solution in the File Exchange? export_fig is the "Most Popular" download.
I have an old m-function, A4Paper, which I use now and then. It produces a figure, the size of A4-paper, on screen. It allows me to position axes using centimeters and when printed on paper size and location on the printed paper agrees "exactly" with those given. E.g.
ohf = A4Paper( 'create', 'sa4' );
U = get( gcf, 'UserData' );
axes( 'pos', U.p2d.*[ 3, 3, 8, 8 ] )
and File menu, Print gives me a printout on which I can use a ruler. Both axes are 80 mm long as far as I can measured with my old plastic ruler.
However, I fail to print to a file. I tried to print to the Adobe PDF printer, and a couple of variants with the function, print. On paper they end up some 5% to small. The margins are increased and the printing area is decreased.
This makes me tired.
I've mailed A4Paper to you via [Contact Craig]. You might want to delete it together with other spam.
  1 Comment
Craig
Craig on 16 Jan 2013
Hi per isakson,
I have emailed you as well. I obtained a "screen ruler" for the computer and I notice that on 100% in Matlab the figure axis does not seem to represent any dimension I am familiar with. The axis reads 0.05 (function calculated from metres) yet when I measure it is roughly 3.75cm with the screen rule.
I obtained a connection to a printer but every attempt leads back to the discrepancy in measurement.

Sign in to comment.


Michael Wagner
Michael Wagner on 13 Sep 2023
G'day Craig,
After a weekend of trials and errors, I found the following code to work for my problem of printing a 10cm square to paper with precise dimensions:
f=figure(1);
f.Units='centimeters';
f.Position(3:4)=[10,10];
f.PaperType="A4";
f.PaperUnits="centimeters";
fig.PaperPosition(3:4)=[10,10];
get(f) %get list of all figure properties
R = [0,10,10, 0,0 %Plot rectangle of size 10cm x 10cm
0, 0,10,10,0];
plot(R(1,:),R(2,:))
a=gca;
a.Units='centimeters';
a.XLim=[0,10];
a.YLim=[0,10];
a.InnerPosition(3:4)=[10,10];
a.PlotBoxAspectRatio=[1 1 1];
get(a) %get list of all axes properties
  1 Comment
Michael Wagner
Michael Wagner on 13 Sep 2023
Delete Line 6, starting with fig.PaperPosition, and make Lines 4 & 5 prettier with single quotes.

Sign in to comment.

Categories

Find more on Polar Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!