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.

Antworten (1)

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

Kategorien

Mehr zu Printing and Saving finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 7 Apr. 2022

Beantwortet:

am 7 Apr. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by