필터 지우기
필터 지우기

print() and saveas() produce svg files where text is stored as paths and not text - how to overcome?

조회 수: 88 (최근 30일)
I am trying to export an .svg image of a matlab figure (see attachement) to convert it afterwards in Inkscape to a .pdf_tex file to include it in a nice way into my latex document. However when trying to export it with eiter print() or saveas() it always saves the labels as vector graphics paths and not as text. This makes it afterwards unfeasible to save the text of the image (labels, etc) as propper text for the latex file.
I have so far tried multiple things:
% Open the figure
openfig("25m_baseline_smoothing.fig");
h = gcf();
h.Renderer = "painters"; % To make sure I have a vector image
% Trial 1
print("25m_baseline_smoothing","-dsvg"); % Produces paths
% Trial 2
saveas(h, "25m_baseline_smoothing","svg"); % Produces paths, not text
Futher I also tried to save the figure with the menu in the figure dropdown menu (File > Save as...). I also tried to directly export the figure with matlab2tikz. This is not a solution either as matlab2tikz can't handle a tiled layout yet.
Is there a way to overcome this problem and export the labes directly as text to the .svg image?
Kind regards,

채택된 답변

Zahra Yousefi Darani
Zahra Yousefi Darani 2023년 1월 13일
I know where the problem comes from. When you use greek letter in the labels of axes, it is not compatible with the fonts of InkScape. The only solution that comes to my mind is that remove the greek letter in your code (labeling or text). Export your figure to .svg then open it in InkScape. After opening, apply your editions, then copy the greek letters as object path, from the figure that you have and is not text-recognnizable, then paste it to the current figure (text-recognizable).

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by