I want to create printouts with exact sizes (1=1")
조회 수: 11 (최근 30일)
이전 댓글 표시
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
채택된 답변
Chunru
2022년 4월 22일
편집: Chunru
2022년 4월 22일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Properties에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!