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.

Réponses (1)

x=1;
m=[1,2];
bar(x,m);
exportgraphics(gcf,'myplot.png','Resolution',300)

Catégories

En savoir plus sur Printing and Saving dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by