Frame adjustment of a printed PNG file

8 Ansichten (letzte 30 Tage)
Mehmet  Emin
Mehmet Emin am 14 Dez. 2015
Beantwortet: Nishant Kumar am 14 Jan. 2016
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.
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

Antworten (1)

Nishant Kumar
Nishant Kumar am 14 Jan. 2016
% 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']);
.
.
.

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by