Why is saveas() changing my image aspect ratio?
조회 수: 4 (최근 30일)
이전 댓글 표시
I'm trying to save a figure as a PNG but the aspect ratio changes for some reason.
This is how it looks in MATLAB:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1036080/image.png)
This is how it looks when I save it (slightly elongated as you can see):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1036085/image.png)
How can I fix this?
g = figure;
subplot(1,2,1)
imagesc(im1);
subplot(1,2,2)
imagesc(im2);
g.WindowState = 'maximized'; % this didn't work
saveas(g, name, "png");
댓글 수: 0
답변 (2개)
Eamon Gekakis
2022년 6월 17일
The exportgraphics function may be useful here, 'Resolution' is available as a name-value pair input argument.
참고 항목
카테고리
Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!