Setting box size in Figure
조회 수: 20 (최근 30일)
이전 댓글 표시
Dear All,
I have been using matlab to generate figures with data. I typically set the figure size using "PaperSize", like in the example below, which works well for most cases. However, I would like to be able to set the size of the box instead (by box, I mean the space enclosed by the horizontal and vertical axes).
The reason for this is that often I try to put together different figures into a composite larger figure, and whenever the numbers in the axes have different formats (e.g. diferent decimals or powers), the box size is automatically adjusted. Hence, when I try to align the different individual figures, there is a mismatch... It is not a huge problem, but it affects my OCD a bit :)
As sort of a workaround I have been using subplot, but it is not optimal. It would be great to know if I can set the box size instead of the full figure.
Thanks
set(gcf, 'PaperUnits', 'inches');
set(gcf, 'PaperSize', [4 2]);
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition', [0 0 4 2]);
댓글 수: 0
채택된 답변
Jan
2022년 5월 6일
You can set the position (including the dimensions) of an axes as the "Position" (this is the InnerPosition), "TighInset" or "OuterPosition": https://www.mathworks.com/help/matlab/creating_plots/automatic-axes-resize.html
Use the PositionConstraint to avoid a rescaling (in Matlab < R2020a: "ActivePositionProperty").
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!