print() and saveas() produce svg files where text is stored as paths and not text - how to overcome?
75 次查看(过去 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,
0 个评论
采纳的回答
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).
1 个评论
Daniel
2023-7-28
You star! This is the answer to something I've been banging my head against the wall about! Thank you!
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Labels and Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!