exporting figures as vector graphics without white spacing

Hello
I am
(1) trying to reduce the amount of white space around my figure when it is saved in matlab
(2) I am trying to export it as vector graphics
My code , generalized to a simple example, is as follows:
figure(figureNum);figureNum=figureNum+1;
x=1;
m=[1,2];
bar(x,m); hold on %mean on the y-axis
set(gca,'fontsize',fontSize);
I tried
exportgraphics(gca,'myplot.png','Resolution',300) and it did not work.

답변 (1개)

David Hill
David Hill 2022년 4월 7일
x=1;
m=[1,2];
bar(x,m);
exportgraphics(gcf,'myplot.png','Resolution',300)

카테고리

도움말 센터File Exchange에서 Printing and Saving에 대해 자세히 알아보기

질문:

2022년 4월 7일

답변:

2022년 4월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by