I want to create printouts with exact sizes (1=1")
11 views (last 30 days)
Show older comments
I somewhat frequently use Matlab to create images of things I want to build (as in build a physical object). In some situations, it would be useful to create a figure that's the exact size of the object I want to build. I can create, for example, a box that's 1x1 in the dimensions of my figure, but by the time I go through saving and then printing with all the attendant options, the "size" gets changed multiple times.
I'm about to write a function that creates a figure of a specified size and then exports that figure to a file and then print that file and then measure 1 unit with a ruler and then keep adjusting the parameters until I get it approximately right, but if there's a cleaner way to do it I'd like to hear it.
0 Comments
Accepted Answer
Chunru
on 22 Apr 2022
Edited: Chunru
on 22 Apr 2022
g = figure;
g.Units = 'inches';
g.Position = [1 2 3 3]; % 3 by 3 inches
plot(rand(10,1));
saveas('test.pdf');
% You can measure the figure size in pdf to be the one you specified (outer
% box including the axis labels)
% If you want to set the axes size
%{
a = gca;
a.Units = "inches";
g.Position = [1 2 3 3]; % adjust these values
%}
6 Comments
More Answers (0)
See Also
Categories
Find more on Graphics Object Properties 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!