Frame adjustment of a printed PNG file
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi,
I have written a MATLAB code that prints out a plot as a PNG file. But I couldn't find how to adjust the outer frame of the PNG file, there's so much gap between the frame and axeses and I dont want to crop it everytime while I'm using it on MS office. So, I wonder if there is a way to solve this problem with some additional codes.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152636/image.png)
example code
.
.
.
figure(2);
set(gcf,'PaperUnits','centimeters'); % Printed figure properties
set(gcf,'PaperSize', [36 17]);
set(gcf,'PaperPosition',[0.1 0.1 35.8 16.8]);
plot(X,Z,'b-','LineWidth',2);
grid on
grid minor
title([i,' X-Z ']);
xlabel('X(m)');
ylabel('Z(m)');
Xmax11 = Xmax1 + mod(Xmax1,10000); % Tick gap
set(gca,'XTick',0:5000:Xmax11);
print ('-painters','-dpng','-r300',[i, ' X-Z.png']);
.
.
.
Thanks in advance
댓글 수: 0
답변 (1개)
Nishant Kumar
2016년 1월 14일
% Try this code
.
.
.
figure(2);
%set(gcf,'PaperUnits','centimeters'); % Printed figure properties
%set(gcf,'PaperSize', [36 17]);
%set(gcf,'PaperPosition',[0.1 0.1 35.8 16.8]);
plot(X,Z,'b-','LineWidth',2);
grid on
grid minor
title([i,' X-Z ']);
xlabel('X(m)');
ylabel('Z(m)');
Xmax11 = Xmax1 + mod(Xmax1,10000); % Tick gap
set(gca,'XTick',0:5000:Xmax11);
saveas(gcf,[i, ' X-Z.png']);
%print ('-painters','-dpng','-r300',[i, ' X-Z.png']);
.
.
.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!