hello,
I wanted to have all my graphs in the same aspect ratio, same fonts, etc ,etc,etc
so I created an small function that takes the image and sets everything I want and saves the figure as an svg
function ExportFiguresSized(figure,name)
Axes=get(figure,'CurrentAxes');
set(Axes,'FontSize', 30,'FontName','Calibri','FontWeight','bold');
set(figure,'Position',[0,1.058333333333334,50.800000000000004,25.479375000000005],'Units','centimeters','InnerPosition',[0,1.058333333333334,50.800000000000004,25.479375000000005], 'OuterPosition', [-0.211666666666667,0.846666666666667,51.22333333333334,27.940000000000005],'Clipping','on','Resize','on')
saveas(figure,name,'svg')
end
but I am having trouble with something,
in my script i have two different figures and use this function
test2=figure(1);
plot(signals(:,:))
ExportFiguresSized(test2,'test2')
test=figure(25);
plot(signals(:,:))
ExportFiguresSized(test,'test')
But I am facing an strange behavior, the first image created "test2" is not being saved as an svg but as a bitmap (when i open it with inkscape is not a real svg) but at the same time the second image created "test" it is an svg and i can modify as i want.
I can not understand why this is happening, someone could enlight me? or tell me why this is happening?

 採用された回答

Jan
Jan 2021 年 3 月 23 日

1 投票

Try to set the renderer of the figure to Painters. The OpenGL renderer creates pixel graphics.

3 件のコメント

franco otaola
franco otaola 2021 年 3 月 23 日
thanks it works,
I can not understand why, as in one of the cases it was working and the other no.... the only subtable difference that I saw is that the vector image that was not working, now that is works and is a real svg, its size is way bigger than the one that was working from the begginig, (5mb vs 100 kb)
strange....
in any case, thanks!
Jan
Jan 2021 年 3 月 23 日
If the figure renderer mode is set to 'auto', Matlab decides which renderer to use. This can depend on the number of graphic elements and if the data contain 3D values or not. You are on the save side, if you set the renderer explicitly to your needs.
franco otaola
franco otaola 2021 年 3 月 23 日
what I suspected when i saw the difference in the size, thanks a lot :D

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangePrinting and Saving についてさらに検索

製品

リリース

R2018b

タグ

質問済み:

2021 年 3 月 23 日

コメント済み:

2021 年 3 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by